diff --git a/checksum.zig b/checksum.zig index 4cae35a..1dccee7 100644 --- a/checksum.zig +++ b/checksum.zig @@ -122,7 +122,7 @@ test "checksum test vectors" { } test "checksum simple fuzzing" { - var prng = std.rand.DefaultPrng.init(42); + var prng = std.Random.DefaultPrng.init(42); const msg_min = 1; const msg_max = 1 * 1024 * 1024; @@ -180,7 +180,7 @@ test "checksum stability" { } // Pseudo-random data from a specific PRNG of various lengths. - var prng = std.rand.Xoshiro256.init(92); + var prng = std.Random.Xoshiro256.init(92); subcase = 0; while (subcase < 256) : (subcase += 1) { const message = buf[0 .. subcase + 13]; diff --git a/io/linux.zig b/io/linux.zig index 44c0205..d428b1c 100644 --- a/io/linux.zig +++ b/io/linux.zig @@ -119,12 +119,11 @@ pub const IO = struct { // We must use the same clock source used by io_uring (CLOCK_MONOTONIC) since we specify the // timeout below as an absolute value. Otherwise, we may deadlock if the clock sources are // dramatically different. Any kernel that supports io_uring will support CLOCK_MONOTONIC. - var current_ts: posix.timespec = undefined; - posix.clock_gettime(posix.CLOCK.MONOTONIC, ¤t_ts) catch unreachable; + const current_ts = posix.clock_gettime(posix.CLOCK.MONOTONIC) catch unreachable; // The absolute CLOCK_MONOTONIC time after which we may return from this function: const timeout_ts: os.linux.kernel_timespec = .{ - .tv_sec = current_ts.tv_sec, - .tv_nsec = current_ts.tv_nsec + nanoseconds, + .sec = current_ts.sec, + .nsec = current_ts.nsec + nanoseconds, }; var timeouts: usize = 0; var etime = false; @@ -175,8 +174,8 @@ pub const IO = struct { // 2) potentially queues more SQEs to take advantage more of the next flush_submissions(). while (self.completed.pop()) |completion| { if (completion.operation == .timeout and - completion.operation.timeout.timespec.tv_sec == 0 and - completion.operation.timeout.timespec.tv_nsec == 0) + completion.operation.timeout.timespec.sec == 0 and + completion.operation.timeout.timespec.nsec == 0) { // Zero-duration timeouts are a special case, and aren't listed in `awaiting`. maybe(self.awaiting.empty()); @@ -1359,7 +1358,7 @@ pub const IO = struct { }.wrapper, .operation = .{ .timeout = .{ - .timespec = .{ .tv_sec = 0, .tv_nsec = nanoseconds }, + .timespec = .{ .sec = 0, .nsec = nanoseconds }, }, }, }; diff --git a/list.zig b/list.zig index 3f514be..e94756d 100644 --- a/list.zig +++ b/list.zig @@ -11,7 +11,7 @@ pub fn DoublyLinkedListType( comptime field_back_enum: std.meta.FieldEnum(Node), comptime field_next_enum: std.meta.FieldEnum(Node), ) type { - assert(@typeInfo(Node) == .Struct); + assert(@typeInfo(Node) == .@"struct"); assert(field_back_enum != field_next_enum); assert(std.meta.FieldType(Node, field_back_enum) == ?*Node); assert(std.meta.FieldType(Node, field_next_enum) == ?*Node); diff --git a/stdx.zig b/stdx.zig index c9c3a54..696c2b4 100644 --- a/stdx.zig +++ b/stdx.zig @@ -17,7 +17,7 @@ pub const log = if (builtin.is_test) // Downgrade `err` to `warn` for tests. // Zig fails any test that does `log.err`, but we want to test those code paths here. struct { - pub fn scoped(comptime scope: @Type(.EnumLiteral)) type { + pub fn scoped(comptime scope: @Type(.enum_literal)) type { const base = std.log.scoped(scope); return struct { pub const err = warn; diff --git a/time.zig b/time.zig index 0bfb73c..2aa7dd5 100644 --- a/time.zig +++ b/time.zig @@ -67,9 +67,8 @@ pub const Time = struct { // CLOCK_BOOTTIME is the same as CLOCK_MONOTONIC but includes elapsed time during a suspend. // For more detail and why CLOCK_MONOTONIC_RAW is even worse than CLOCK_MONOTONIC, // see https://github.com/ziglang/zig/pull/933#discussion_r656021295. - var ts: std.posix.timespec = undefined; - std.posix.clock_gettime(std.posix.CLOCK.BOOTTIME, &ts) catch @panic("CLOCK_BOOTTIME required"); - break :blk @as(u64, @intCast(ts.tv_sec)) * std.time.ns_per_s + @as(u64, @intCast(ts.tv_nsec)); + const ts = std.posix.clock_gettime(std.posix.CLOCK.BOOTTIME) catch @panic("CLOCK_BOOTTIME required"); + break :blk @as(u64, @intCast(ts.sec)) * std.time.ns_per_s + @as(u64, @intCast(ts.nsec)); }; // "Oops!...I Did It Again" @@ -105,7 +104,7 @@ pub const Time = struct { var ts: std.posix.timespec = undefined; std.posix.clock_gettime(std.posix.CLOCK.REALTIME, &ts) catch unreachable; - return @as(i64, ts.tv_sec) * std.time.ns_per_s + ts.tv_nsec; + return @as(i64, ts.sec) * std.time.ns_per_s + ts.nsec; } pub fn tick(_: *Self) void {}