From 875affe19905b430fdc5514418cde32f5f25119e Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Tue, 10 Feb 2026 18:39:10 -0800 Subject: [PATCH] use nektro/zig-time --- licenses.txt | 5 +++++ ulid.zig | 3 ++- zig.mod | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/licenses.txt b/licenses.txt index d4c94a95e939601ac7a79c42e59b40136b7f73e1..abf29eb324881e489cac33c89790989bd3321f2a 100644 --- a/licenses.txt +++ b/licenses.txt @@ -2,3 +2,8 @@ MIT: = https://spdx.org/licenses/MIT - This - git https://github.com/nektro/zig-extras +- git https://github.com/nektro/zig-sys-linux +- git https://github.com/nektro/zig-time + +Unspecified: +- system_lib c diff --git a/ulid.zig b/ulid.zig index 00962ccf3728aff46c9205160dce1d63354d0f54..0397d8d75565cc2a3484e8cdc206202247a35060 100644 --- a/ulid.zig +++ b/ulid.zig @@ -4,6 +4,7 @@ const std = @import("std"); const string = []const u8; const base32 = @import("./base32.zig"); const extras = @import("extras"); +const time = @import("time"); pub const Factory = struct { epoch: i64, @@ -17,7 +18,7 @@ pub const Factory = struct { } pub fn newULID(self: Factory) ULID { - const now = std.time.milliTimestamp(); + const now = time.milliTimestamp(); return ULID{ .timestamp = std.math.cast(u48, now - self.epoch) orelse @panic("time.milliTimestamp() is higher than 281474976710655"), // this is Tue Aug 02 10889 05:31:50.655 UTC .randomnes = self.rand.int(u80), diff --git a/zig.mod b/zig.mod index e26b2db2d352a17d468369ad99f14d57ad94898f..b1ba39ec7c8f6e427e9629618f349b46f01067ef 100644 --- a/zig.mod +++ b/zig.mod @@ -6,3 +6,4 @@ description: ULID implementation for Zig min_zig_version: 0.10.0-dev.2431+0e6285c8f dependencies: - src: git https://github.com/nektro/zig-extras + - src: git https://github.com/nektro/zig-time -- 2.54.0