diff --git a/ulid.zig b/ulid.zig index 1dd4546ab0c1dd01456ba1a7aa351eae02a10cb7..84fdc64f0b3f566ce0649abf9b0d6413fe398e90 100644 --- a/ulid.zig +++ b/ulid.zig @@ -75,4 +75,8 @@ pub const ULID = struct { pub fn stringifyJson(self: ULID, writer: anytype, options: std.json.Stringify.Options, json: type) !void { return json.stringify(writer, &self.bytes(), options); } + + pub fn createdAt(self: ULID, epoch: u64) time.DateTime { + return .initUnixMs(epoch + self.timestamp); + } };