Skip to content

Commit cc8948e

Browse files
committed
time: fix compilation on macos
1 parent 3ea9868 commit cc8948e

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

vlib/time/time.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ module time
55

66
#include <time.h>
77

8+
type time_t = i64
9+
810
pub const (
911
days_string = 'MonTueWedThuFriSatSun'
1012
month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

vlib/time/time_darwin.c.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ fn darwin_now() Time {
6767
tv := C.timeval{}
6868
C.gettimeofday(&tv, 0)
6969
loc_tm := C.tm{}
70-
C.localtime_r(&tv.tv_sec, &loc_tm)
70+
asec := voidptr(&tv.tv_sec)
71+
C.localtime_r(&time_t(asec), &loc_tm)
7172
return convert_ctime(loc_tm, int(tv.tv_usec))
7273
}
7374

vlib/time/time_nix.c.v

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ pub fn (t Time) local() Time {
3434
return convert_ctime(loc_tm, t.microsecond)
3535
}
3636

37-
type time_t = i64
38-
3937
// in most systems, these are __quad_t, which is an i64
4038
struct C.timespec {
4139
mut:

0 commit comments

Comments
 (0)