aboutsummaryrefslogtreecommitdiff
path: root/src/platform/posix/posix_clock.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-22 15:23:21 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-22 15:23:21 -0800
commit934c1316ae47754a2e368c65228c3cbfe552680f (patch)
treee81c4d2854df83e3d908c9269dd35c0600fa6acb /src/platform/posix/posix_clock.c
parentee969ad99dc1e07e1c38876223e7aed13463b121 (diff)
downloadnng-934c1316ae47754a2e368c65228c3cbfe552680f.tar.gz
nng-934c1316ae47754a2e368c65228c3cbfe552680f.tar.bz2
nng-934c1316ae47754a2e368c65228c3cbfe552680f.zip
Inline locks (fewer allocs), simpler absolute times for wakeups. nn_sock_recv.
Diffstat (limited to 'src/platform/posix/posix_clock.c')
-rw-r--r--src/platform/posix/posix_clock.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/platform/posix/posix_clock.c b/src/platform/posix/posix_clock.c
index 48a1e09b..c4206ebe 100644
--- a/src/platform/posix/posix_clock.c
+++ b/src/platform/posix/posix_clock.c
@@ -19,11 +19,11 @@
#ifndef NNG_USE_GETTIMEOFDAY
// Use POSIX realtime stuff
-uint64_t
+nni_time
nni_clock(void)
{
struct timespec ts;
- uint64_t usec;
+ nni_time usec;
if (clock_gettime(NNG_USE_CLOCKID, &ts) != 0) {
/* This should never ever occur. */
@@ -38,7 +38,7 @@ nni_clock(void)
void
-nni_usleep(uint64_t usec)
+nni_usleep(nni_duration usec)
{
struct timespec ts;
@@ -67,10 +67,10 @@ nni_usleep(uint64_t usec)
#include <sys/time.h>
#include <poll.h>
-uint64_t
+nni_time
nni_clock(void)
{
- uint64_t usec;
+ nni_time usec;
struct timeval tv;
@@ -86,7 +86,7 @@ nni_clock(void)
void
-nni_usleep(uint64_t usec)
+nni_usleep(nni_duration usec)
{
// So probably there is no nanosleep. We could in theory use
// pthread condition variables, but that means doing memory
@@ -97,8 +97,8 @@ nni_usleep(uint64_t usec)
// So we can use poll() instead, which is rather coarse, but
// pretty much guaranteed to work.
struct pollfd pfd;
- uint64_t now;
- uint64_t expire;
+ nni_time now;
+ nni_time expire;
// Possibly we could pass NULL instead of pfd, but passing a valid
// pointer ensures that if the system dereferences the pointer it