瀏覽代碼

disable time_diff in hl_sys_time on xbox: kills precision

Nicolas Cannasse 6 年之前
父節點
當前提交
9907c7d39e
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/std/sys.c

+ 4 - 2
src/std/sys.c

@@ -167,8 +167,6 @@ HL_PRIM double hl_sys_time() {
 	static double time_diff = 0.;
 	static double freq = 0.;
 	LARGE_INTEGER time;
-	LARGE_INTEGER start_time;
-	FILETIME ft;
 
 	if( freq == 0 ) {
 		QueryPerformanceFrequency(&time);
@@ -176,12 +174,16 @@ HL_PRIM double hl_sys_time() {
 	}
 	QueryPerformanceCounter(&time);
 
+#	ifndef HL_CONSOLE
 	if( time_diff == 0 ) {
+		FILETIME ft;
+		LARGE_INTEGER start_time;
 		GetSystemTimeAsFileTime(&ft);
 		start_time.LowPart = ft.dwLowDateTime;
 		start_time.HighPart = ft.dwHighDateTime;
 		time_diff = ((double)start_time.QuadPart - (double)time.QuadPart) / freq - EPOCH_DIFF;
 	}
+#	endif
 
 	return time_diff + ((double)time.QuadPart) / freq;
 #else