lib: minor, ensure we have TIMESPEC_TO_TIMEVAL()

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg 2023-04-30 20:02:51 +02:00
parent c6de7dfa69
commit ae15ee11a7

View File

@ -21,12 +21,20 @@
#endif #endif
#include <sys/time.h> /* lutimes(), utimes(), utimensat() */ #include <sys/time.h> /* 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 int
__utimensat(int dirfd, const char *pathname, const struct timespec ts[2], int flags) __utimensat(int dirfd, const char *pathname, const struct timespec ts[2], int flags)
{ {
int ret = -1; int ret = -1;
struct timeval tv[2]; struct timeval tv[2];
(void)flags;
if (dirfd != 0) { if (dirfd != 0) {
errno = ENOTSUP; errno = ENOTSUP;
return -1; return -1;