aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-04-22 15:26:59 +0100
committerRon Yorston <rmy@pobox.com>2022-04-22 15:39:42 +0100
commit037037df6cdc567132acbeeb2067c442f945889e (patch)
tree1bc314e37d3bc23f571a5a13ac847b45640e839a /win32
parent3cbe64df41eb408740a59145c6318b71f47c4f6d (diff)
downloadbusybox-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.c13
-rw-r--r--win32/sys/syscall.h0
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
930int 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
930int pipe(int filedes[2]) 943int 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