mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
time: fix macos job (building V with -cflags --Werror)
This commit is contained in:
parent
5f07c583fb
commit
7c664de8aa
@ -68,7 +68,7 @@ fn darwin_now() Time {
|
|||||||
C.gettimeofday(&tv, 0)
|
C.gettimeofday(&tv, 0)
|
||||||
loc_tm := C.tm{}
|
loc_tm := C.tm{}
|
||||||
asec := voidptr(&tv.tv_sec)
|
asec := voidptr(&tv.tv_sec)
|
||||||
C.localtime_r(&time_t(asec), &loc_tm)
|
C.localtime_r(asec, &loc_tm)
|
||||||
return convert_ctime(loc_tm, int(tv.tv_usec))
|
return convert_ctime(loc_tm, int(tv.tv_usec))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ fn make_unix_time(t C.tm) int {
|
|||||||
// local returns t with the location set to local time.
|
// local returns t with the location set to local time.
|
||||||
pub fn (t Time) local() Time {
|
pub fn (t Time) local() Time {
|
||||||
loc_tm := C.tm{}
|
loc_tm := C.tm{}
|
||||||
C.localtime_r(&time_t(voidptr(&t.unix)), &loc_tm)
|
C.localtime_r(voidptr(&t.unix), &loc_tm)
|
||||||
return convert_ctime(loc_tm, t.microsecond)
|
return convert_ctime(loc_tm, t.microsecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ fn linux_now() Time {
|
|||||||
mut ts := C.timespec{}
|
mut ts := C.timespec{}
|
||||||
C.clock_gettime(C.CLOCK_REALTIME, &ts)
|
C.clock_gettime(C.CLOCK_REALTIME, &ts)
|
||||||
loc_tm := C.tm{}
|
loc_tm := C.tm{}
|
||||||
C.localtime_r(&time_t(voidptr(&ts.tv_sec)), &loc_tm)
|
C.localtime_r(voidptr(&ts.tv_sec), &loc_tm)
|
||||||
return convert_ctime(loc_tm, int(ts.tv_nsec / 1000))
|
return convert_ctime(loc_tm, int(ts.tv_nsec / 1000))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user