|
|
@@ -10,7 +10,6 @@
|
|
|
#endif
|
|
|
|
|
|
#include "pocketpy/pocketpy.h"
|
|
|
-#include "pocketpy/common/threads.h"
|
|
|
#include <assert.h>
|
|
|
|
|
|
#define NANOS_PER_SEC 1000000000
|
|
|
@@ -18,20 +17,8 @@
|
|
|
#ifndef __circle__
|
|
|
|
|
|
int64_t time_ns() {
|
|
|
-#ifdef _WIN32
|
|
|
- FILETIME system_time;
|
|
|
- ULARGE_INTEGER large;
|
|
|
-
|
|
|
- GetSystemTimePreciseAsFileTime(&system_time);
|
|
|
- large.u.LowPart = system_time.dwLowDateTime;
|
|
|
- large.u.HighPart = system_time.dwHighDateTime;
|
|
|
- /* 11,644,473,600,000,000,000: number of nanoseconds between
|
|
|
- the 1st january 1601 and the 1st january 1970 (369 years + 89 leap
|
|
|
- days). */
|
|
|
- return (large.QuadPart - 116444736000000000) * 100;
|
|
|
-#else
|
|
|
struct timespec tms;
|
|
|
-#ifdef CLOCK_REALTIME
|
|
|
+#if !defined(_WIN32) && defined(CLOCK_REALTIME)
|
|
|
clock_gettime(CLOCK_REALTIME, &tms);
|
|
|
#else
|
|
|
/* The C11 way */
|
|
|
@@ -42,7 +29,6 @@ int64_t time_ns() {
|
|
|
/* Add full nanoseconds */
|
|
|
nanos += tms.tv_nsec;
|
|
|
return nanos;
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
int64_t time_monotonic_ns() {
|