Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/std/Io.zig
Original file line number Diff line number Diff line change
Expand Up @@ -734,16 +734,16 @@ pub const Clock = enum {
/// A settable system-wide clock that measures real (i.e. wall-clock)
/// time. This clock is affected by discontinuous jumps in the system
/// time (e.g., if the system administrator manually changes the
/// clock), and by frequency adjust‐ ments performed by NTP and similar
/// clock), and by frequency adjustments performed by NTP and similar
/// applications.
///
/// This clock normally counts the number of seconds since 1970-01-01
/// 00:00:00 Coordinated Universal Time (UTC) except that it ignores
/// leap seconds; near a leap second it is typically adjusted by NTP to
/// stay roughly in sync with UTC.
///
/// The epoch is implementation-defined. For example NTFS/Windows uses
/// 1601-01-01.
/// The epoch is 1970-01-01T00:00:00Z, which corresponds to a clock
/// value of zero.
real,
/// A nonsettable system-wide clock that represents time since some
/// unspecified point in the past.
Expand Down
3 changes: 2 additions & 1 deletion lib/std/Io/Threaded.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2864,7 +2864,8 @@ fn nowWindows(userdata: ?*anyopaque, clock: Io.Clock) Io.Clock.Error!Io.Timestam
.real => {
// RtlGetSystemTimePrecise() has a granularity of 100 nanoseconds
// and uses the NTFS/Windows epoch, which is 1601-01-01.
return .{ .nanoseconds = @as(i96, windows.ntdll.RtlGetSystemTimePrecise()) * 100 };
const epoch_100_ns = std.time.epoch.windows * (std.time.ns_per_s / 100);
return .{ .nanoseconds = @as(i96, windows.ntdll.RtlGetSystemTimePrecise() + epoch_100_ns) * 100 };
},
.awake, .boot => {
// QPC on windows doesn't fail on >= XP/2000 and includes time suspended.
Expand Down