aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/clock.c23
-rw-r--r--src/core/clock.h19
-rw-r--r--src/core/nng_impl.h4
-rw-r--r--src/core/platform.h12
4 files changed, 51 insertions, 7 deletions
diff --git a/src/core/clock.c b/src/core/clock.c
new file mode 100644
index 00000000..3e36358a
--- /dev/null
+++ b/src/core/clock.c
@@ -0,0 +1,23 @@
+//
+// Copyright 2017 Garrett D'Amore <garrett@damore.org>
+//
+// This software is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+#include "core/nng_impl.h"
+
+nni_time
+nni_clock(void)
+{
+ return (nni_plat_clock());
+}
+
+
+void
+nni_usleep(nni_duration usec)
+{
+ nni_plat_usleep(usec);
+}
diff --git a/src/core/clock.h b/src/core/clock.h
new file mode 100644
index 00000000..c46adfbe
--- /dev/null
+++ b/src/core/clock.h
@@ -0,0 +1,19 @@
+//
+// Copyright 2017 Garrett D'Amore <garrett@damore.org>
+//
+// This software is supplied under the terms of the MIT License, a
+// copy of which should be located in the distribution where this
+// file was obtained (LICENSE.txt). A copy of the license may also be
+// found online at https://opensource.org/licenses/MIT.
+//
+
+#ifndef CORE_CLOCK_H
+#define CORE_CLOCK_H
+
+#include "core/nng_impl.h"
+
+extern nni_time nni_clock(void);
+
+extern void nni_usleep(nni_duration usec);
+
+#endif // CORE_CLOCK_H \ No newline at end of file
diff --git a/src/core/nng_impl.h b/src/core/nng_impl.h
index 6bf0900d..ff25f5ad 100644
--- a/src/core/nng_impl.h
+++ b/src/core/nng_impl.h
@@ -22,9 +22,11 @@
// those starting with nng_ are intended for external consumption. The latter
// symbols should be found in the toplevel nng.h header.
#include "core/defs.h"
-#include "core/list.h"
+
+#include "core/clock.h"
#include "core/idhash.h"
#include "core/init.h"
+#include "core/list.h"
#include "core/message.h"
#include "core/msgqueue.h"
#include "core/options.h"
diff --git a/src/core/platform.h b/src/core/platform.h
index 2955215b..f7bec4ca 100644
--- a/src/core/platform.h
+++ b/src/core/platform.h
@@ -123,16 +123,16 @@ extern int nni_plat_thr_init(nni_plat_thr *, void (*)(void *), void *);
// is an error to reference the thread in any further way.
extern void nni_plat_thr_fini(nni_plat_thr *);
-// nn_clock returns a number of microseconds since some arbitrary time
+// nn_plat_clock returns a number of microseconds since some arbitrary time
// in the past. The values returned by nni_clock must use the same base
-// as the times used in nni_cond_waituntil. The nni_clock() must return
-// values > 0, and must return values smaller than 2^63. (We could relax
+// as the times used in nni_plat_cond_waituntil. The nni_plat_clock() must
+// returnvalues > 0, and must return values smaller than 2^63. (We could relax
// this last constraint, but there is no reason to, and leaves us the option
// of using negative values for other purposes in the future.)
-extern nni_time nni_clock(void);
+extern nni_time nni_plat_clock(void);
-// nni_usleep sleeps for the specified number of microseconds (at least).
-extern void nni_usleep(nni_duration);
+// nni_plat_usleep sleeps for the specified number of microseconds (at least).
+extern void nni_plat_usleep(nni_duration);
// nni_plat_init is called to allow the platform the chance to
// do any necessary initialization. This routine MUST be idempotent,