Sfoglia il codice sorgente

Changed to extract directly into FILETIME stuct.

Brucey 3 anni fa
parent
commit
635483e23b
1 ha cambiato i file con 7 aggiunte e 3 eliminazioni
  1. 7 3
      stdc.mod/stdc.c

+ 7 - 3
stdc.mod/stdc.c

@@ -340,10 +340,14 @@ int ftruncate_(FILE* stream, BBLONG size) {
 
 int clock_gettime_(int id, struct timespec * spec) {
 	__int64 ftime;
-	GetSystemTimeAsFileTime((FILETIME*)&ftime);
-	ftime -= 116444736000000000LL;
+	union {
+        unsigned __int64 ftime;
+        FILETIME ft;
+    } ft;
+	GetSystemTimeAsFileTime(&ft.ft);
+	ftime = ft.ftime - 116444736000000000LL;
 	spec->tv_sec = ftime / 10000000LL;
-	spec->tv_nsec = ftime % 10000000LL *100;
+	spec->tv_nsec = ((int)(ftime % 10000000LL)) *100;
 	return 0;
 }