authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-04-25 17:09:27 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-04-25 17:09:27 -07:00
log6094c777eb7b7fbadbf5102f3872d3ad0a2a630e
tree7ac1afc370c57dd5395e66811e3e1d1563755dc3
parentd3a17e27f0ffcb4447db9ae71ed30ad0318820a4

add DateTime.since()


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

time.zig+10
......@@ -383,6 +383,12 @@ pub const DateTime = struct {
383383 x, // unix milli
384384 X, // unix
385385 };
386
387 pub fn since(self: Self, other_in_the_past: Self) Duration {
388 return Duration{
389 .ms = self.toUnixMilli() - other_in_the_past.toUnixMilli(),
390 };
391 }
386392};
387393
388394pub const format = struct {
......@@ -472,3 +478,7 @@ fn wrap(val: u16, at: u16) !u16 {
472478 var tmp = val % at;
473479 return if (tmp == 0) at else tmp;
474480}
481
482pub const Duration = struct {
483 ms: u64,
484};