Skip to content

Instantly share code, notes, and snippets.

@mati865
Created August 7, 2019 10:56
Show Gist options
  • Save mati865/b422b41f2c2784361091db78354d4bc8 to your computer and use it in GitHub Desktop.
Save mati865/b422b41f2c2784361091db78354d4bc8 to your computer and use it in GitHub Desktop.
[package]
name = "libc_test"
version = "0.1.0"
authors = ["Mateusz Mikuła <mati865@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
libc = { version = "0.2", default-features = false }
fn main() {
let mut timespec = libc::timespec {
tv_sec: 0,
tv_nsec: 0,
};
unsafe { libc::clock_gettime(libc::CLOCK_REALTIME, &mut timespec) };
println!("{}\n{:#?}", timespec.tv_nsec, std::time::SystemTime::now());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment