blueloveTH 1 tahun lalu
induk
melakukan
6541b0faba
1 mengubah file dengan 3 tambahan dan 3 penghapusan
  1. 3 3
      src/modules/time.c

+ 3 - 3
src/modules/time.c

@@ -6,11 +6,11 @@
 
 
 int64_t time_ns() {
 int64_t time_ns() {
     struct timespec tms;
     struct timespec tms;
-#ifdef _MSC_VER
+#ifdef CLOCK_REALTIME
+    clock_gettime(CLOCK_REALTIME, &tms);
+#else
     /* The C11 way */
     /* The C11 way */
     timespec_get(&tms, TIME_UTC);
     timespec_get(&tms, TIME_UTC);
-#else
-    clock_gettime(CLOCK_REALTIME, &tms);
 #endif
 #endif
     /* seconds, multiplied with 1 billion */
     /* seconds, multiplied with 1 billion */
     int64_t nanos = tms.tv_sec * NANOS_PER_SEC;
     int64_t nanos = tms.tv_sec * NANOS_PER_SEC;