summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-12-08 10:14:54 +0200
committerLars Wirzenius <liw@liw.fi>2020-12-08 10:14:54 +0200
commitb4524782aa6f5ea780b5a029ef0f06b0674ef269 (patch)
tree6f01148598992a188bb4a48bd2adac955e3f4712 /src/main.rs
downloadfoo-b4524782aa6f5ea780b5a029ef0f06b0674ef269.tar.gz
initial commit
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs17
1 files changed, 17 insertions, 0 deletions
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(())
+}