rust/src/lib/time.rs
Brian Anderson 518dc52f85 Reformat
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00

22 lines
463 B
Rust

native "rust" mod rustrt {
fn get_time(sec: &mutable u32, usec: &mutable u32);
fn nano_time(ns: &mutable u64);
}
type timeval = {sec: u32, usec: u32};
fn get_time() -> timeval {
let sec = 0u32;
let usec = 0u32;
rustrt::get_time(sec, usec);
ret {sec: sec, usec: usec};
}
fn precise_time_ns() -> u64 { let ns = 0u64; rustrt::nano_time(ns); ret ns; }
fn precise_time_s() -> float {
ret (precise_time_ns() as float) / 1000000000.;
}