mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
io: Translate Windows Clock.real timestamps to the POSIX/Unix epoch
This fixes `std.http.Client` TLS certificate validation on Windows.
This commit is contained in:
parent
cbfa87cbea
commit
ed7f2588e4
@ -2864,7 +2864,8 @@ fn nowWindows(userdata: ?*anyopaque, clock: Io.Clock) Io.Clock.Error!Io.Timestam
|
|||||||
.real => {
|
.real => {
|
||||||
// RtlGetSystemTimePrecise() has a granularity of 100 nanoseconds
|
// RtlGetSystemTimePrecise() has a granularity of 100 nanoseconds
|
||||||
// and uses the NTFS/Windows epoch, which is 1601-01-01.
|
// and uses the NTFS/Windows epoch, which is 1601-01-01.
|
||||||
return .{ .nanoseconds = @as(i96, windows.ntdll.RtlGetSystemTimePrecise()) * 100 };
|
const epoch_ns = std.time.epoch.windows * std.time.ns_per_s;
|
||||||
|
return .{ .nanoseconds = @as(i96, windows.ntdll.RtlGetSystemTimePrecise()) * 100 + epoch_ns };
|
||||||
},
|
},
|
||||||
.awake, .boot => {
|
.awake, .boot => {
|
||||||
// QPC on windows doesn't fail on >= XP/2000 and includes time suspended.
|
// QPC on windows doesn't fail on >= XP/2000 and includes time suspended.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user