Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.time: add Date #18272

Closed
wants to merge 10 commits into from
4 changes: 2 additions & 2 deletions lib/std/io/Reader.zig
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ pub fn isBytes(self: Self, slice: []const u8) anyerror!bool {
}

pub fn readStruct(self: Self, comptime T: type) anyerror!T {
// Only extern and packed structs have defined in-memory layout.
comptime assert(@typeInfo(T).Struct.layout != .Auto);
// Only extern structs have defined in-memory layout.
comptime assert(@typeInfo(T).Struct.layout == .Extern);
Vexu marked this conversation as resolved.
Show resolved Hide resolved
var res: [1]T = undefined;
try self.readNoEof(mem.sliceAsBytes(res[0..]));
return res[0];
Expand Down
22 changes: 22 additions & 0 deletions lib/std/os/windows.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5044,6 +5044,7 @@ pub const SYSTEM_INFORMATION_CLASS = enum(c_int) {
SystemInterruptInformation = 23,
SystemExceptionInformation = 33,
SystemRegistryQuotaInformation = 37,
SystemCurrentTimeZoneInformation = 44,
SystemLookasideInformation = 45,
SystemCodeIntegrityInformation = 103,
SystemPolicyInformation = 134,
Expand All @@ -5063,6 +5064,27 @@ pub const SYSTEM_BASIC_INFORMATION = extern struct {
NumberOfProcessors: UCHAR,
};

pub const TIME_ZONE_INFORMATION = extern struct {
Bias: LONG,
StandardName: [32]WCHAR,
StandardDate: SYSTEMTIME,
StandardBias: LONG,
DaylightName: [32]WCHAR,
DaylightDate: SYSTEMTIME,
DaylightBias: LONG,
};

pub const SYSTEMTIME = extern struct {
wYear: WORD,
wMonth: WORD,
wDayOfWeek: WORD,
wDay: WORD,
wHour: WORD,
wMinute: WORD,
wSecond: WORD,
wMilliseconds: WORD,
};

pub const THREADINFOCLASS = enum(c_int) {
ThreadBasicInformation,
ThreadTimes,
Expand Down
4 changes: 0 additions & 4 deletions lib/std/std.zig
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ pub const TailQueue = DoublyLinkedList;
pub const Target = @import("target.zig").Target;
pub const Thread = @import("Thread.zig");
pub const Treap = @import("treap.zig").Treap;
pub const Tz = tz.Tz;
pub const Uri = @import("Uri.zig");

pub const array_hash_map = @import("array_hash_map.zig");
Expand Down Expand Up @@ -177,9 +176,6 @@ pub const testing = @import("testing.zig");
/// Sleep, obtaining the current time, conversion constants, and more.
pub const time = @import("time.zig");

/// Time zones.
pub const tz = @import("tz.zig");

/// UTF-8 and UTF-16LE encoding/decoding.
pub const unicode = @import("unicode.zig");

Expand Down