diff options
Diffstat (limited to 'Userland/Libraries/LibC/time.cpp')
-rw-r--r-- | Userland/Libraries/LibC/time.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/time.cpp b/Userland/Libraries/LibC/time.cpp index 56ef7a3663..9331bbde13 100644 --- a/Userland/Libraries/LibC/time.cpp +++ b/Userland/Libraries/LibC/time.cpp @@ -35,6 +35,7 @@ #include <sys/times.h> #include <syscall.h> #include <time.h> +#include <utime.h> extern "C" { @@ -68,6 +69,16 @@ int settimeofday(struct timeval* __restrict__ tv, void* __restrict__) return clock_settime(CLOCK_REALTIME, &ts); } +int utimes(const char* pathname, const struct timeval times[2]) +{ + if (!times) { + return utime(pathname, nullptr); + } + // FIXME: implement support for tv_usec in the utime (or a new) syscall + utimbuf buf = { times[0].tv_sec, times[1].tv_sec }; + return utime(pathname, &buf); +} + char* ctime(const time_t* t) { return asctime(localtime(t)); |