Skip to main content

gettimeofday/
gettimeofday.rs

1// Copyright (c) 2020 Xu Shaohua <shaohua@biofan.org>. All rights reserved.
2// Use of this source is governed by Apache-2.0 License that can be found
3// in the LICENSE file.
4
5fn main() {
6    let mut timeval = nc::timeval_t::default();
7    let ret = unsafe { nc::gettimeofday(&mut timeval, None) };
8    match ret {
9        Err(errno) => eprintln!("gettimeofday() failed: {}", nc::strerror(errno)),
10        Ok(_) => println!("time: {:+?}", timeval),
11    }
12}