summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-01-10 18:24:55 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-01-10 18:24:55 -0300
commita120c66f98586138fc61fa6f243cb071d60111bc (patch)
tree61deb7f8b8443bee3e028ad9ae347496eea4e458 /platform
parent5b088b41b3147cc19f2d5bc56b762bd5988bc484 (diff)
-Removed OS.get_system_time_msec(), this is undoable on Windows and also unusable from GDscript due to precision.
-Added, instead an OS.get_system_time_secs(), which is 32 bits friendly, fixes #3143
Diffstat (limited to 'platform')
-rw-r--r--platform/windows/os_windows.cpp10
-rw-r--r--platform/windows/os_windows.h2
2 files changed, 9 insertions, 3 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 95bfa2ea94..6ac27b7dbf 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1681,10 +1681,16 @@ uint64_t OS_Windows::get_unix_time() const {
return (*(uint64_t*)&ft - *(uint64_t*)&fep) / 10000000;
};
-uint64_t OS_Windows::get_system_time_msec() const {
+uint64_t OS_Windows::get_system_time_secs() const {
SYSTEMTIME st;
GetSystemTime(&st);
- return st.wMilliseconds;
+ FILETIME ft;
+ SystemTimeToFileTime(&st,&ft);
+ uint64_t ret;
+ ret=ft.dwHighDateTime;
+ ret<<=32;
+ ret|=ft.dwLowDateTime;
+ return ret;
}
void OS_Windows::delay_usec(uint32_t p_usec) const {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index dfa2b40595..69bdcda278 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -231,7 +231,7 @@ public:
virtual Time get_time(bool utc) const;
virtual TimeZoneInfo get_time_zone_info() const;
virtual uint64_t get_unix_time() const;
- virtual uint64_t get_system_time_msec() const;
+ virtual uint64_t get_system_time_secs() const;
virtual bool can_draw() const;
virtual Error set_cwd(const String& p_cwd);