aboutsummaryrefslogtreecommitdiff
path: root/std/os/time.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-06-12 01:55:08 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-06-12 01:57:09 -0400
commit3dd9af9948db696362aa5f41481dc4cb034bc6c2 (patch)
tree747a0f203be57fc407d82ee6371602e897597661 /std/os/time.zig
parent0a18d53c3dc9816677071c20ab846e3866787b39 (diff)
downloadzig-3dd9af9948db696362aa5f41481dc4cb034bc6c2.tar.gz
zig-3dd9af9948db696362aa5f41481dc4cb034bc6c2.zip
implement std.os.Dir for windows
improve std.os.File.access so that it does not depend on shlwapi.dll closes #1084
Diffstat (limited to 'std/os/time.zig')
-rw-r--r--std/os/time.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/std/os/time.zig b/std/os/time.zig
index dd64df2156..43a584d936 100644
--- a/std/os/time.zig
+++ b/std/os/time.zig
@@ -68,11 +68,13 @@ pub const milliTimestamp = switch (builtin.os) {
fn milliTimestampWindows() u64 {
//FileTime has a granularity of 100 nanoseconds
// and uses the NTFS/Windows epoch
- var ft: i64 = undefined;
+ var ft: windows.FILETIME = undefined;
windows.GetSystemTimeAsFileTime(&ft);
const hns_per_ms = (ns_per_s / 100) / ms_per_s;
const epoch_adj = epoch.windows * ms_per_s;
- return u64(@divFloor(ft, hns_per_ms) + epoch_adj);
+
+ const ft64 = (u64(ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
+ return @divFloor(ft64, hns_per_ms) - - epoch_adj;
}
fn milliTimestampDarwin() u64 {