| ... | ... | @@ -383,6 +383,12 @@ pub const DateTime = struct { |
| 383 | 383 | x, // unix milli |
| 384 | 384 | X, // unix |
| 385 | 385 | }; |
| 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 | } |
| 386 | 392 | }; |
| 387 | 393 | |
| 388 | 394 | pub const format = struct { |
| ... | ... | @@ -472,3 +478,7 @@ fn wrap(val: u16, at: u16) !u16 { |
| 472 | 478 | var tmp = val % at; |
| 473 | 479 | return if (tmp == 0) at else tmp; |
| 474 | 480 | } |
| 481 | |
| 482 | pub const Duration = struct { |
| 483 | ms: u64, |
| 484 | }; |