summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/time/utime.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/time/utime.c')
-rw-r--r--libc-top-half/musl/src/time/utime.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/time/utime.c b/libc-top-half/musl/src/time/utime.c
new file mode 100644
index 0000000..e7592b2
--- /dev/null
+++ b/libc-top-half/musl/src/time/utime.c
@@ -0,0 +1,11 @@
+#include <utime.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <fcntl.h>
+
+int utime(const char *path, const struct utimbuf *times)
+{
+ return utimensat(AT_FDCWD, path, times ? ((struct timespec [2]){
+ { .tv_sec = times->actime }, { .tv_sec = times->modtime }})
+ : 0, 0);
+}