| ... | @@ -494,3 +494,33 @@ fn wrap(val: u16, at: u16) u16 { | ... | @@ -494,3 +494,33 @@ fn wrap(val: u16, at: u16) u16 { |
| 494 | pub const Duration = struct { | 494 | pub const Duration = struct { |
| 495 | ms: u64, | 495 | ms: u64, |
| 496 | }; | 496 | }; |
| | 497 | |
| | 498 | // Divisions of a nanosecond. |
| | 499 | pub const ns_per_us = 1000; |
| | 500 | pub const ns_per_ms = 1000 * ns_per_us; |
| | 501 | pub const ns_per_s = 1000 * ns_per_ms; |
| | 502 | pub const ns_per_min = 60 * ns_per_s; |
| | 503 | pub const ns_per_hour = 60 * ns_per_min; |
| | 504 | pub const ns_per_day = 24 * ns_per_hour; |
| | 505 | pub const ns_per_week = 7 * ns_per_day; |
| | 506 | |
| | 507 | // Divisions of a microsecond. |
| | 508 | pub const us_per_ms = 1000; |
| | 509 | pub const us_per_s = 1000 * us_per_ms; |
| | 510 | pub const us_per_min = 60 * us_per_s; |
| | 511 | pub const us_per_hour = 60 * us_per_min; |
| | 512 | pub const us_per_day = 24 * us_per_hour; |
| | 513 | pub const us_per_week = 7 * us_per_day; |
| | 514 | |
| | 515 | // Divisions of a millisecond. |
| | 516 | pub const ms_per_s = 1000; |
| | 517 | pub const ms_per_min = 60 * ms_per_s; |
| | 518 | pub const ms_per_hour = 60 * ms_per_min; |
| | 519 | pub const ms_per_day = 24 * ms_per_hour; |
| | 520 | pub const ms_per_week = 7 * ms_per_day; |
| | 521 | |
| | 522 | // Divisions of a second. |
| | 523 | pub const s_per_min = 60; |
| | 524 | pub const s_per_hour = s_per_min * 60; |
| | 525 | pub const s_per_day = s_per_hour * 24; |
| | 526 | pub const s_per_week = s_per_day * 7; |