ci: fix `v -cc clang-11 -cflags -Werror cmd/v`
parent
4cde74f120
commit
c58b4cb1da
|
@ -30,11 +30,11 @@ 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(&t.unix), &loc_tm)
|
C.localtime_r(&time_t(voidptr(&t.unix)), &loc_tm)
|
||||||
return convert_ctime(loc_tm, t.microsecond)
|
return convert_ctime(loc_tm, t.microsecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
type time_t = voidptr
|
type time_t = i64
|
||||||
|
|
||||||
// in most systems, these are __quad_t, which is an i64
|
// in most systems, these are __quad_t, which is an i64
|
||||||
struct C.timespec {
|
struct C.timespec {
|
||||||
|
@ -79,7 +79,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.time_t(&ts.tv_sec), &loc_tm)
|
C.localtime_r(&time.time_t(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