Added OS.get_system_time_msecs()

This commit is contained in:
volzhs
2018-12-20 06:18:52 +09:00
parent 26058376aa
commit 84d060c768
9 changed files with 33 additions and 3 deletions

View File

@ -2142,8 +2142,13 @@ 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;
return get_system_time_msecs() / 1000;
}
uint64_t OS_Windows::get_system_time_msecs() const {
const uint64_t WINDOWS_TICK = 10000;
const uint64_t MSEC_TO_UNIX_EPOCH = 11644473600000LL;
SYSTEMTIME st;
GetSystemTime(&st);
@ -2154,7 +2159,7 @@ uint64_t OS_Windows::get_system_time_secs() const {
ret <<= 32;
ret |= ft.dwLowDateTime;
return (uint64_t)(ret / WINDOWS_TICK - SEC_TO_UNIX_EPOCH);
return (uint64_t)(ret / WINDOWS_TICK - MSEC_TO_UNIX_EPOCH);
}
void OS_Windows::delay_usec(uint32_t p_usec) const {