mirror of
https://github.com/godotengine/godot.git
synced 2025-10-15 02:49:24 +00:00
property output unix seconds since epoch in windows get_system_time_secs, fixes #5155
(cherry picked from commit fc7adf0b4c
)
This commit is contained in:

committed by
Rémi Verschelde

parent
25244e9843
commit
dd7e7c94c1
@@ -1698,6 +1698,11 @@ uint64_t OS_Windows::get_unix_time() const {
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t OS_Windows::get_system_time_secs() 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;
|
SYSTEMTIME st;
|
||||||
GetSystemTime(&st);
|
GetSystemTime(&st);
|
||||||
FILETIME ft;
|
FILETIME ft;
|
||||||
@@ -1706,7 +1711,8 @@ uint64_t OS_Windows::get_system_time_secs() const {
|
|||||||
ret=ft.dwHighDateTime;
|
ret=ft.dwHighDateTime;
|
||||||
ret<<=32;
|
ret<<=32;
|
||||||
ret|=ft.dwLowDateTime;
|
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 {
|
void OS_Windows::delay_usec(uint32_t p_usec) const {
|
||||||
|
Reference in New Issue
Block a user