From 9f0fcbd84a6ee3655f55629ed4b01d13647ac0c9 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 22 Jul 2021 00:57:13 -0700 Subject: Remove extra wrapper for platform clock support. --- src/platform/posix/posix_clock.c | 14 +++++++------- src/platform/windows/win_clock.c | 4 ++-- src/platform/windows/win_thread.c | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/platform') diff --git a/src/platform/posix/posix_clock.c b/src/platform/posix/posix_clock.c index 1fa05cb1..d5435009 100644 --- a/src/platform/posix/posix_clock.c +++ b/src/platform/posix/posix_clock.c @@ -1,5 +1,5 @@ // -// Copyright 2017 Garrett D'Amore +// Copyright 2021 Garrett D'Amore // Copyright 2017 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a @@ -21,7 +21,7 @@ // Use POSIX realtime stuff nni_time -nni_plat_clock(void) +nni_clock(void) { struct timespec ts; nni_time msec; @@ -38,7 +38,7 @@ nni_plat_clock(void) } void -nni_plat_sleep(nni_duration ms) +nni_msleep(nni_duration ms) { struct timespec ts; @@ -69,7 +69,7 @@ nni_plat_sleep(nni_duration ms) #include nni_time -nni_plat_clock(void) +nni_clock(void) { nni_time ms; @@ -86,7 +86,7 @@ nni_plat_clock(void) } void -nni_plat_sleep(nni_duration ms) +nni_msleep(nni_duration ms) { // So probably there is no nanosleep. We could in theory use // pthread condition variables, but that means doing memory @@ -105,12 +105,12 @@ nni_plat_sleep(nni_duration ms) pfd.fd = -1; pfd.events = 0; - now = nni_plat_clock(); // XXX: until nni_plat_clock returns ms. + now = nni_clock(); expire = now + ms; while (now < expire) { (void) poll(&pfd, 0, (int) (expire - now)); - now = nni_plat_clock(); + now = nni_clock(); } } diff --git a/src/platform/windows/win_clock.c b/src/platform/windows/win_clock.c index 613af4be..fc338fdb 100644 --- a/src/platform/windows/win_clock.c +++ b/src/platform/windows/win_clock.c @@ -13,14 +13,14 @@ #ifdef NNG_PLATFORM_WINDOWS nni_time -nni_plat_clock(void) +nni_clock(void) { // We are limited by the system clock, but that is ok. return (GetTickCount64()); } void -nni_plat_sleep(nni_duration dur) +nni_msleep(nni_duration dur) { uint64_t exp; diff --git a/src/platform/windows/win_thread.c b/src/platform/windows/win_thread.c index c069d3c9..dc9ed12a 100644 --- a/src/platform/windows/win_thread.c +++ b/src/platform/windows/win_thread.c @@ -1,5 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. +// Copyright 2021 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a @@ -144,7 +144,7 @@ nni_plat_cv_until(nni_plat_cv *cv, nni_time until) DWORD msec; BOOL ok; - now = nni_plat_clock(); + now = nni_clock(); if (now > until) { msec = 0; } else { -- cgit v1.2.3-70-g09d2