You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Fix Time.get_unix_time_from_system() not including msecs
This commit is contained in:
@@ -549,6 +549,23 @@ uint64_t OS_UWP::get_unix_time() const {
|
||||
return (*(uint64_t *)&ft - *(uint64_t *)&fep) / 10000000;
|
||||
};
|
||||
|
||||
double OS_UWP::get_subsecond_unix_time() const {
|
||||
// 1 Windows tick is 100ns
|
||||
const uint64_t WINDOWS_TICKS_PER_SECOND = 10000000;
|
||||
const uint64_t TICKS_TO_UNIX_EPOCH = 116444736000000000LL;
|
||||
|
||||
SYSTEMTIME st;
|
||||
GetSystemTime(&st);
|
||||
FILETIME ft;
|
||||
SystemTimeToFileTime(&st, &ft);
|
||||
uint64_t ticks_time;
|
||||
ticks_time = ft.dwHighDateTime;
|
||||
ticks_time <<= 32;
|
||||
ticks_time |= ft.dwLowDateTime;
|
||||
|
||||
return (double)(ticks_time - TICKS_TO_UNIX_EPOCH) / WINDOWS_TICKS_PER_SECOND;
|
||||
}
|
||||
|
||||
void OS_UWP::delay_usec(uint32_t p_usec) const {
|
||||
int msec = p_usec < 1000 ? 1 : p_usec / 1000;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user