authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-21 20:36:05 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-21 20:36:05 -07:00
log6947fa581e7fdb447e06d1a0444af3a60d38f5d1
tree1e4a33ba6e0a2530143d11e60a6b3325297195a6
parentf9a433b782d15b6526af2faf3e222eb4efe7f6cd

add DateTime.initUnix that accepts seconds


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

time.zig+4
...@@ -19,6 +19,10 @@ pub const DateTime = struct {...@@ -19,6 +19,10 @@ pub const DateTime = struct {
19 return unix_epoch.addMs(unix);19 return unix_epoch.addMs(unix);
20 }20 }
2121
22 pub fn initUnix(unix: u64) Self {
23 return unix_epoch.addSecs(unix);
24 }
25
22 /// Caller asserts that this is > epoch26 /// Caller asserts that this is > epoch
23 pub fn init(year: u16, month: u16, day: u16, hr: u16, min: u16, sec: u16) Self {27 pub fn init(year: u16, month: u16, day: u16, hr: u16, min: u16, sec: u16) Self {
24 return unix_epoch28 return unix_epoch