authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-07-25 05:33:11-07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-07-25 05:33:11-07:00
log92e685c09cb549fb128ed8d01ebb316b2e371b97
treee1f13279f4df0800d8ed7125d84f1c46863365ad
parentdcca09510f26fa26ccba55828199a83583714560
signature Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

DateTime: add nowAtOffset


1 files changed, 6 insertions(+), 0 deletions(-)

time.zig+6
...@@ -46,6 +46,12 @@ pub const DateTime = struct {...@@ -46,6 +46,12 @@ pub const DateTime = struct {
46 return initUnixMs(@intCast(milliTimestamp()));46 return initUnixMs(@intCast(milliTimestamp()));
47 }47 }
4848
49 pub fn nowAtOffset(offset: i8) DateTime {
50 var result: DateTime = .initUnixMs(@intCast(milliTimestamp() + (@as(i64, offset) * 15 * ms_per_min)));
51 result.z_offset = offset;
52 return result;
53 }
54
49 pub const epoch_unix = DateTime{55 pub const epoch_unix = DateTime{
50 .ms = 0,56 .ms = 0,
51 .seconds = 0,57 .seconds = 0,