diff options
Diffstat (limited to 'src/platform/windows/win_clock.c')
| -rw-r--r-- | src/platform/windows/win_clock.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/platform/windows/win_clock.c b/src/platform/windows/win_clock.c index fc338fdb..2beeec45 100644 --- a/src/platform/windows/win_clock.c +++ b/src/platform/windows/win_clock.c @@ -1,5 +1,5 @@ // -// Copyright 2017 Garrett D'Amore <garrett@damore.org> +// Copyright 2024 Garrett D'Amore <garrett@damore.org> // Copyright 2017 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -10,6 +10,8 @@ #include "core/nng_impl.h" +#include <time.h> + #ifdef NNG_PLATFORM_WINDOWS nni_time @@ -19,6 +21,19 @@ nni_clock(void) return (GetTickCount64()); } +int +nni_time_get(uint64_t *seconds, uint32_t *nanoseconds) +{ + int rv; + struct timespec ts; + if (timespec_get(&ts, TIME_UTC) == TIME_UTC) { + *seconds = ts.tv_sec; + *nanoseconds = ts.tv_nsec; + return (0); + } + return (nni_win_error(GetLastError())); +} + void nni_msleep(nni_duration dur) { |
