authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-07-14 17:12:03 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-07-14 17:12:03 -07:00
logd2834174ee6a0011ee42fe43be2886c539a146ce
treee2927da0c911b4224fb33cf0b39052b8c396cee1
parent27dd9c8d9e35e88225ac91052b94cba43d185aba

update to stdlib breakage


2 files changed, 4 insertions(+), 3 deletions(-)

ulid.zig+3-3
......@@ -19,14 +19,14 @@ pub const Factory = struct {
1919 pub fn newULID(self: Factory) ULID {
2020 const now = std.time.milliTimestamp();
2121 return ULID{
22 .timestamp = std.math.cast(u48, now - self.epoch) catch @panic("time.milliTimestamp() is higher than 281474976710655"),
22 .timestamp = std.math.cast(u48, now - self.epoch) orelse @panic("time.milliTimestamp() is higher than 281474976710655"),
2323 .randomnes = self.rand.int(u80),
2424 };
2525 }
2626};
2727
2828/// 01AN4Z07BY 79KA1307SR9X4MV3
29///
29///
3030/// |----------| |----------------|
3131/// Timestamp Randomness
3232/// 48bits 80bits
......@@ -41,7 +41,7 @@ pub const ULID = struct {
4141 pub fn parse(alloc: std.mem.Allocator, value: BaseType) !ULID {
4242 if (value.len != 26) return error.Ulid;
4343 return ULID{
44 .timestamp = try std.math.cast(u48, try extras.sliceToInt(u50, u5, try base32.decode(alloc, value[0..10]))),
44 .timestamp = std.math.cast(u48, try extras.sliceToInt(u50, u5, try base32.decode(alloc, value[0..10]))) orelse return error.Ulid,
4545 .randomnes = try extras.sliceToInt(u80, u5, try base32.decode(alloc, value[10..26])),
4646 };
4747 }
zig.mod+1
......@@ -3,6 +3,7 @@ name: ulid
33main: ulid.zig
44license: MIT
55description: ULID implementation for Zig
6min_zig_version: 0.10.0-dev.2431+0e6285c8f
67dependencies:
78 - src: git https://github.com/nektro/zig-range
89 - src: git https://github.com/nektro/zig-extras