From 1a03b8c8992d1a739363f289566334ba2a970cca Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 2 Mar 2025 23:13:58 +0000 Subject: [PATCH] std.os.uefi: Fix two padding mistakes in the Time struct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ```c //************************************************ //EFI_TIME //************************************************ // This represents the current time information typedef struct { UINT16 Year; // 1900 - 9999 UINT8 Month; // 1 - 12 UINT8 Day; // 1 - 31 UINT8 Hour; // 0 - 23 UINT8 Minute; // 0 - 59 UINT8 Second; // 0 - 59 UINT8 Pad1; UINT32 Nanosecond; // 0 - 999,999,999 INT16 TimeZone; // —1440 to 1440 or 2047 UINT8 Daylight; UINT8 Pad2; } EFI_TIME; ``` --- lib/std/os/uefi.zig | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/std/os/uefi.zig b/lib/std/os/uefi.zig index d7f6da26cf..f7e51c63aa 100644 --- a/lib/std/os/uefi.zig +++ b/lib/std/os/uefi.zig @@ -113,22 +113,30 @@ pub const Time = extern struct { /// 0 - 59 second: u8, + _pad1: u8, + /// 0 - 999999999 nanosecond: u32, /// The time's offset in minutes from UTC. /// Allowed values are -1440 to 1440 or unspecified_timezone timezone: i16, - daylight: packed struct { - _pad1: u6, - + daylight: packed struct(u8) { /// If true, the time has been adjusted for daylight savings time. in_daylight: bool, /// If true, the time is affected by daylight savings time. adjust_daylight: bool, + + _: u6, }, + _pad2: u8, + + comptime { + std.debug.assert(@sizeOf(Time) == 16); + } + /// Time is to be interpreted as local time pub const unspecified_timezone: i16 = 0x7ff;