summaryrefslogtreecommitdiff
path: root/src/platform/windows
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-10-19 15:16:25 -0700
committerGarrett D'Amore <garrett@damore.org>2017-10-19 17:56:49 -0700
commit4e668fdd5b5da0d46f97d835249dbe5f0ea319a7 (patch)
tree0aaad8a672024b3a510763150b167320be6f1f5b /src/platform/windows
parentd7e39a2423212a31c5ef62dcb0b7a5b4bf9f34df (diff)
downloadnng-4e668fdd5b5da0d46f97d835249dbe5f0ea319a7.tar.gz
nng-4e668fdd5b5da0d46f97d835249dbe5f0ea319a7.tar.bz2
nng-4e668fdd5b5da0d46f97d835249dbe5f0ea319a7.zip
fixes #84 Consider using msec for durations
There is now a public nng_duration type. We have also updated the zerotier work to work with the signed int64_t's that the latst ZeroTier dev branch is using.
Diffstat (limited to 'src/platform/windows')
-rw-r--r--src/platform/windows/win_clock.c11
-rw-r--r--src/platform/windows/win_thread.c3
2 files changed, 5 insertions, 9 deletions
diff --git a/src/platform/windows/win_clock.c b/src/platform/windows/win_clock.c
index 949b2dfc..613af4be 100644
--- a/src/platform/windows/win_clock.c
+++ b/src/platform/windows/win_clock.c
@@ -1,5 +1,6 @@
//
-// Copyright 2016 Garrett D'Amore <garrett@damore.org>
+// Copyright 2017 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
// copy of which should be located in the distribution where this
@@ -15,18 +16,14 @@ nni_time
nni_plat_clock(void)
{
// We are limited by the system clock, but that is ok.
- return (GetTickCount64() * 1000);
+ return (GetTickCount64());
}
void
-nni_plat_usleep(nni_duration dur)
+nni_plat_sleep(nni_duration dur)
{
uint64_t exp;
- // Convert duration to msec, rounding up.
- dur += 999;
- dur /= 1000;
-
exp = (uint64_t) GetTickCount64() + dur;
// Sleep() would be our preferred API, if it didn't have a nasty
diff --git a/src/platform/windows/win_thread.c b/src/platform/windows/win_thread.c
index 41ba721c..0d9e7387 100644
--- a/src/platform/windows/win_thread.c
+++ b/src/platform/windows/win_thread.c
@@ -91,8 +91,7 @@ nni_plat_cv_until(nni_plat_cv *cv, nni_time until)
if (now > until) {
msec = 0;
} else {
- // times are in usec, but win32 wants millis
- msec = (DWORD)(((until - now) + 999) / 1000);
+ msec = (DWORD)(until - now);
}
ok = SleepConditionVariableSRW(&cv->cv, cv->srl, msec, 0);