File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -2334,17 +2334,19 @@ microsecond-resolution timer.
2334
2334
2335
2335
~~~~
2336
2336
use std;
2337
- type timeval = {mutable tv_sec: u32 ,
2338
- mutable tv_usec: u32 };
2337
+ type timeval = {mutable tv_sec: uint ,
2338
+ mutable tv_usec: uint };
2339
2339
#[nolink]
2340
2340
native mod libc {
2341
2341
fn gettimeofday(tv: *timeval, tz: *()) -> i32;
2342
2342
}
2343
2343
fn unix_time_in_microseconds() -> u64 unsafe {
2344
- let x = {mutable tv_sec: 0u32 , mutable tv_usec: 0u32 };
2344
+ let x = {mutable tv_sec: 0u , mutable tv_usec: 0u };
2345
2345
libc::gettimeofday(ptr::addr_of(x), ptr::null());
2346
2346
ret (x.tv_sec as u64) * 1000_000_u64 + (x.tv_usec as u64);
2347
2347
}
2348
+
2349
+ # fn main() { assert #fmt("%?", unix_time_in_microseconds()) != ""; }
2348
2350
~~~~
2349
2351
2350
2352
The ` #[nolink] ` attribute indicates that there's no native library to link
You can’t perform that action at this time.
0 commit comments