summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-11 14:09:21 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-11 14:10:11 -0300
commitfc7adf0b4c2d501ca2732d366156ad32e187a912 (patch)
tree6444244a5657119263f0c7bc8ad8cecd24e05690 /platform
parent0bda0fcb3e8985fe613b696761ab5f211316faf7 (diff)
property output unix seconds since epoch in windows get_system_time_secs, fixes #5155
Diffstat (limited to 'platform')
-rw-r--r--platform/windows/os_windows.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 9034541f37..630d5715e9 100644
--- a/platform/windows/os_windows.cpp
+++ b/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 {