Time::now()

This commit is contained in:
Mike Dilger 2024-02-18 08:53:21 +13:00
parent 4122014ff7
commit 6f2708c1a4

View File

@ -21,4 +21,9 @@ impl Time {
pub fn max() -> Time {
Time(u64::MAX)
}
pub fn now() -> Time {
// Safety: unwrap() can only panic if the system time is before UNIX_EPOCH
Time(std::time::UNIX_EPOCH.elapsed().unwrap().as_secs())
}
}