Skip to content

Commit be4c300

Browse files
committed
gnu: Handle timeval.tv_usec for glibc 64-bit time_t
For 64 bit time on 32 bit linux glibc timeval.tv_usec is actually __suseconds64_t (64 bits) while suseconds_t is still 32 bits. References: https://github.com/bminor/glibc/blob/e78caeb4ff812ae19d24d65f4d4d48508154277b/time/bits/types/struct_timeval.h
1 parent 0bbd3cf commit be4c300

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/unix/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ s! {
5656
pub modtime: time_t,
5757
}
5858

59-
// FIXME(time): Needs updates at least for glibc _TIME_BITS=64
6059
pub struct timeval {
6160
pub tv_sec: time_t,
61+
#[cfg(not(gnu_time_bits64))]
6262
pub tv_usec: suseconds_t,
63+
// For 64 bit time on 32 bit linux glibc, suseconds_t is still
64+
// a 32 bit type. Use i64 instead
65+
#[cfg(gnu_time_bits64)]
66+
pub tv_usec: i64,
6367
}
6468

6569
// linux x32 compatibility

0 commit comments

Comments
 (0)