From 21470984c891bcd0b31e8a8ee69b09f555de1cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 1 Aug 2006 11:02:32 +0000 Subject: [PATCH] Added utimes() implementation. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18330 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/sys/Jamfile | 1 + src/system/libroot/posix/sys/utimes.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/system/libroot/posix/sys/utimes.c diff --git a/src/system/libroot/posix/sys/Jamfile b/src/system/libroot/posix/sys/Jamfile index 992a516e3f..a71576c48a 100644 --- a/src/system/libroot/posix/sys/Jamfile +++ b/src/system/libroot/posix/sys/Jamfile @@ -18,5 +18,6 @@ MergeObject posix_sys.o : uio.c umask.c uname.c + utimes.c wait.c ; diff --git a/src/system/libroot/posix/sys/utimes.c b/src/system/libroot/posix/sys/utimes.c new file mode 100644 index 0000000000..00b442b48c --- /dev/null +++ b/src/system/libroot/posix/sys/utimes.c @@ -0,0 +1,25 @@ +/* + * Copyright 2006, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include +#include + + +int +utimes(const char *file, const struct timeval times[2]) +{ + struct utimbuf buffer, *timeBuffer; + + if (times != NULL) { + timeBuffer = &buffer; + buffer.actime = times[0].tv_sec + times[0].tv_usec / 1000000LL; + buffer.modtime = times[1].tv_sec + times[1].tv_usec / 1000000LL; + } else + timeBuffer = NULL; + + return utime(file, timeBuffer); +} +