blob: 493a7bace9f1af5201098430ec75d2e44cb2ddd9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
use libc::{futimens, timespec};
use std::unix::io::AsRawFd;
fn main() -> anyhow::Result<()> {
let f = std::fs::File::create("foo.dat")?;
let fd = f.as_raw_fd();
let ts = timespec {
tv_sec: 1,
tv_nsec: 42,
};
let ret = futimens(fd, &ts);
if ret == -1 {
panic!("futimens failed");
}
Ok(())
}
|