From dd7e7c94c16e490f409fb261184d64654243c60a Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 11 Jun 2016 14:09:21 -0300 Subject: [PATCH] property output unix seconds since epoch in windows get_system_time_secs, fixes #5155 (cherry picked from commit fc7adf0b4c2d501ca2732d366156ad32e187a912) --- platform/windows/os_windows.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 5cc1c868f76..f3db7920981 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1698,6 +1698,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; @@ -1706,7 +1711,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 {