This commit is contained in:
Scott Lamb
2024-08-19 07:57:06 -07:00
parent dad664c244
commit 140f625a80
10 changed files with 36 additions and 49 deletions

View File

@@ -74,17 +74,13 @@ fn parse_zone(input: &str) -> IResult<&str, i32> {
}
impl Time {
pub const MIN: Self = Time(i64::MIN);
pub const MAX: Self = Time(i64::MAX);
pub fn new(tm: time::Timespec) -> Self {
Time(tm.sec * TIME_UNITS_PER_SEC + tm.nsec as i64 * TIME_UNITS_PER_SEC / 1_000_000_000)
}
pub const fn min_value() -> Self {
Time(i64::min_value())
}
pub const fn max_value() -> Self {
Time(i64::max_value())
}
/// Parses a time as either 90,000ths of a second since epoch or a RFC 3339-like string.
///
/// The former is 90,000ths of a second since 1970-01-01T00:00:00 UTC, excluding leap seconds.