Heavily improve time handling on Windows for time.now() and os.File_Info
This commit is contained in:
1 parent
7743e34596
commit
7bcde35651
6 files changed
+77
-49
No files matched your search
@@ -7,9 +7,16 @@ _IS_SUPPORTED :: true
|
||||
|
||||
_now :: proc "contextless" () -> Time {
|
||||
file_time: win32.FILETIME
|
||||
win32.GetSystemTimeAsFileTime(&file_time)
|
||||
ns := win32.FILETIME_as_unix_nanoseconds(file_time)
|
||||
return Time{_nsec=ns}
|
||||
|
||||
ns: i64
|
||||
|
||||
// monotonic
|
||||
win32.GetSystemTimePreciseAsFileTime(&file_time)
|
||||
|
||||
dt := u64(transmute(u64le)file_time) // in 100ns units
|
||||
ns = i64((dt - 116444736000000000) * 100) // convert to ns
|
||||
|
||||
return unix(0, ns)
|
||||
}
|
||||
|
||||
_sleep :: proc "contextless" (d: Duration) {
|
||||
|
||||
Reference in new issue
Block a user