From 6947fa581e7fdb447e06d1a0444af3a60d38f5d1 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Thu, 21 Oct 2021 20:36:05 -0700 Subject: [PATCH] add DateTime.initUnix that accepts seconds --- time.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/time.zig b/time.zig index 30ac036a5f57c4b8b46eb2b52c2b5251c53eceaa..d5234ce622edeaad905675cd65387fce133a316f 100644 --- a/time.zig +++ b/time.zig @@ -19,6 +19,10 @@ pub const DateTime = struct { return unix_epoch.addMs(unix); } + pub fn initUnix(unix: u64) Self { + return unix_epoch.addSecs(unix); + } + /// Caller asserts that this is > epoch pub fn init(year: u16, month: u16, day: u16, hr: u16, min: u16, sec: u16) Self { return unix_epoch -- 2.54.0