From ae15ee11a771147e2259659d4ba8976cd26affe8 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 30 Apr 2023 20:02:51 +0200 Subject: [PATCH] lib: minor, ensure we have TIMESPEC_TO_TIMEVAL() Signed-off-by: Joachim Wiberg --- lib/utimensat.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/utimensat.c b/lib/utimensat.c index 5507e16..8810f80 100644 --- a/lib/utimensat.c +++ b/lib/utimensat.c @@ -21,12 +21,20 @@ #endif #include /* lutimes(), utimes(), utimensat() */ +#ifndef TIMESPEC_TO_TIMEVAL +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} +#endif + int __utimensat(int dirfd, const char *pathname, const struct timespec ts[2], int flags) { int ret = -1; struct timeval tv[2]; + (void)flags; if (dirfd != 0) { errno = ENOTSUP; return -1;