#time #nano #unspecified-epoch #cleaned-up #numbers #extern #lang-time #nano-time

nano_time

Function to get the number of nanoseconds since an unspecified epoch

1 unstable release

Uses old Rust 2015

0.1.0 Jan 3, 2015

#10 in #cleaned

MIT/Apache

6KB
70 lines

nanotime-rs

Simple function to get the system time in nanoseconds relative to an unspecified epoch. Pretty much the same functionality as Java's System.nanoTime().

The code was simply copied from rust-lang/time and cleaned up to just provide the nano_time function with no unneccessary dependencies.

Example

extern crate nano_time;

fn main() {
    let start = nano_time::nano_time();
    do_something();
    let end = nano_time::nano_time();
    println!("do_something() took {} nanoseconds.", (end-start));
}

No runtime deps