Răsfoiți Sursa

Update time.c

blueloveTH 6 zile în urmă
părinte
comite
8461020d8f
1 a modificat fișierele cu 1 adăugiri și 16 ștergeri
  1. 1 16
      src/modules/time.c

+ 1 - 16
src/modules/time.c

@@ -10,7 +10,6 @@
 #endif
 
 #include "pocketpy/pocketpy.h"
-#include "pocketpy/common/threads.h"
 #include <assert.h>
 
 #define NANOS_PER_SEC 1000000000
@@ -18,21 +17,8 @@
 #ifndef __circle__
 
 int64_t time_ns() {
-#if _WIN32 && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0602
-    // windows 8 and later have GetSystemTimePreciseAsFileTime
-    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 */
@@ -43,7 +29,6 @@ int64_t time_ns() {
     /* Add full nanoseconds */
     nanos += tms.tv_nsec;
     return nanos;
-#endif
 }
 
 int64_t time_monotonic_ns() {