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
1 changed files with 8 additions and 0 deletions

View File

@ -21,12 +21,20 @@
#endif
#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
__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;