mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-16 00:36:48 +00:00
Fix using unsafe functions in unix_epoch
This commit is contained in:
parent
602c0e30fe
commit
caaa147b99
@ -13,8 +13,13 @@ impl SystemTime {
|
|||||||
|
|
||||||
const fn unix_epoch() -> Self {
|
const fn unix_epoch() -> Self {
|
||||||
// 1970-01-01 00:00:00
|
// 1970-01-01 00:00:00
|
||||||
let date = Date::__from_ordinal_date_unchecked(1970, 1);
|
let Ok(date) = Date::from_ordinal_date(1970, 1) else {
|
||||||
let time = Time::__from_hms_nanos_unchecked(0, 0, 0, 0);
|
unreachable!()
|
||||||
|
};
|
||||||
|
let Ok(time) = Time::from_hms_nano(0, 0, 0, 0) else {
|
||||||
|
unreachable!()
|
||||||
|
};
|
||||||
|
|
||||||
SystemTime(PrimitiveDateTime::new(date, time))
|
SystemTime(PrimitiveDateTime::new(date, time))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user