diff options
author | Ron Yorston <rmy@pobox.com> | 2022-04-22 15:26:59 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2022-04-22 15:39:42 +0100 |
commit | 037037df6cdc567132acbeeb2067c442f945889e (patch) | |
tree | 1bc314e37d3bc23f571a5a13ac847b45640e839a /win32 | |
parent | 3cbe64df41eb408740a59145c6318b71f47c4f6d (diff) | |
download | busybox-w32-037037df6cdc567132acbeeb2067c442f945889e.tar.gz busybox-w32-037037df6cdc567132acbeeb2067c442f945889e.tar.bz2 busybox-w32-037037df6cdc567132acbeeb2067c442f945889e.zip |
date: enable FEATURE_DATE_NANO
Provide a WIN32 implementation of clock_gettime(2), though only
with support for CLOCK_REALTIME. This makes it possible to enable
FEATURE_DATE_NANO which adds support for the %N date format.
MinGW-w64 has clock_gettime(2) but it's in the winpthreads library
and we don't want to bother with that.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/mingw.c | 13 | ||||
-rw-r--r-- | win32/sys/syscall.h | 0 |
2 files changed, 13 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 91c52b75c..2de07122e 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -927,6 +927,19 @@ int gettimeofday(struct timeval *tv, void *tz UNUSED_PARAM) | |||
927 | return 0; | 927 | return 0; |
928 | } | 928 | } |
929 | 929 | ||
930 | int clock_gettime(clockid_t clockid, struct timespec *tp) | ||
931 | { | ||
932 | FILETIME ft; | ||
933 | |||
934 | if (clockid != CLOCK_REALTIME) { | ||
935 | errno = ENOSYS; | ||
936 | return -1; | ||
937 | } | ||
938 | GetSystemTimeAsFileTime(&ft); | ||
939 | *tp = filetime_to_timespec(&ft); | ||
940 | return 0; | ||
941 | } | ||
942 | |||
930 | int pipe(int filedes[2]) | 943 | int pipe(int filedes[2]) |
931 | { | 944 | { |
932 | if (_pipe(filedes, PIPE_BUF, 0) < 0) | 945 | if (_pipe(filedes, PIPE_BUF, 0) < 0) |
diff --git a/win32/sys/syscall.h b/win32/sys/syscall.h new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/win32/sys/syscall.h | |||