From b4524782aa6f5ea780b5a029ef0f06b0674ef269 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 8 Dec 2020 10:14:54 +0200 Subject: initial commit --- src/main.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/main.rs (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..493a7ba --- /dev/null +++ b/src/main.rs @@ -0,0 +1,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(()) +} -- cgit v1.2.1