authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-02-10 18:39:10 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-02-10 18:39:10 -08:00
log875affe19905b430fdc5514418cde32f5f25119e
treedf01aef981109b961c6c5b41ea2327adb3e4cb2c
parent9b047a3e3df0e86d47c088d376c7b34ef4801a84

use nektro/zig-time


3 files changed, 8 insertions(+), 1 deletions(-)

licenses.txt+5
......@@ -2,3 +2,8 @@ MIT:
22= https://spdx.org/licenses/MIT
33- This
44- git https://github.com/nektro/zig-extras
5- git https://github.com/nektro/zig-sys-linux
6- git https://github.com/nektro/zig-time
7
8Unspecified:
9- system_lib c
ulid.zig+2-1
......@@ -4,6 +4,7 @@ const std = @import("std");
44const string = []const u8;
55const base32 = @import("./base32.zig");
66const extras = @import("extras");
7const time = @import("time");
78
89pub const Factory = struct {
910 epoch: i64,
......@@ -17,7 +18,7 @@ pub const Factory = struct {
1718 }
1819
1920 pub fn newULID(self: Factory) ULID {
20 const now = std.time.milliTimestamp();
21 const now = time.milliTimestamp();
2122 return ULID{
2223 .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
2324 .randomnes = self.rand.int(u80),
zig.mod+1
......@@ -6,3 +6,4 @@ description: ULID implementation for Zig
66min_zig_version: 0.10.0-dev.2431+0e6285c8f
77dependencies:
88 - src: git https://github.com/nektro/zig-extras
9 - src: git https://github.com/nektro/zig-time