Browse Source

property output unix seconds since epoch in windows get_system_time_secs, fixes #5155

Juan Linietsky 9 năm trước cách đây
mục cha
commit
fc7adf0b4c
1 tập tin đã thay đổi với 7 bổ sung1 xóa
  1. 7 1
      platform/windows/os_windows.cpp

+ 7 - 1
platform/windows/os_windows.cpp

@@ -1834,6 +1834,11 @@ uint64_t OS_Windows::get_unix_time() const {
 };
 
 uint64_t OS_Windows::get_system_time_secs() const {
+
+
+	const uint64_t WINDOWS_TICK = 10000000;
+	const uint64_t SEC_TO_UNIX_EPOCH = 11644473600LL;
+
 	SYSTEMTIME st;
 	GetSystemTime(&st);
 	FILETIME ft;
@@ -1842,7 +1847,8 @@ uint64_t OS_Windows::get_system_time_secs() const {
 	ret=ft.dwHighDateTime;
 	ret<<=32;
 	ret|=ft.dwLowDateTime;
-	return ret;
+
+	return (uint64_t)(ret / WINDOWS_TICK - SEC_TO_UNIX_EPOCH);
 }
 
 void OS_Windows::delay_usec(uint32_t p_usec) const {