| author | |
| committer | |
| log | 875affe19905b430fdc5514418cde32f5f25119e |
| tree | df01aef981109b961c6c5b41ea2327adb3e4cb2c |
| parent | 9b047a3e3df0e86d47c088d376c7b34ef4801a84 |
3 files changed, 8 insertions(+), 1 deletions(-)
licenses.txt+5| ... | ... | @@ -2,3 +2,8 @@ MIT: |
| 2 | 2 | = https://spdx.org/licenses/MIT |
| 3 | 3 | - This |
| 4 | 4 | - 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 | ||
| 8 | Unspecified: | |
| 9 | - system_lib c |
ulid.zig+2-1| ... | ... | @@ -4,6 +4,7 @@ const std = @import("std"); |
| 4 | 4 | const string = []const u8; |
| 5 | 5 | const base32 = @import("./base32.zig"); |
| 6 | 6 | const extras = @import("extras"); |
| 7 | const time = @import("time"); | |
| 7 | 8 | |
| 8 | 9 | pub const Factory = struct { |
| 9 | 10 | epoch: i64, |
| ... | ... | @@ -17,7 +18,7 @@ pub const Factory = struct { |
| 17 | 18 | } |
| 18 | 19 | |
| 19 | 20 | pub fn newULID(self: Factory) ULID { |
| 20 | const now = std.time.milliTimestamp(); | |
| 21 | const now = time.milliTimestamp(); | |
| 21 | 22 | return ULID{ |
| 22 | 23 | .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 |
| 23 | 24 | .randomnes = self.rand.int(u80), |
zig.mod+1| ... | ... | @@ -6,3 +6,4 @@ description: ULID implementation for Zig |
| 6 | 6 | min_zig_version: 0.10.0-dev.2431+0e6285c8f |
| 7 | 7 | dependencies: |
| 8 | 8 | - src: git https://github.com/nektro/zig-extras |
| 9 | - src: git https://github.com/nektro/zig-time |