Skip to content

Commit 14600f6

Browse files
committed
pal/uefi: Implement SystemTime::{MIN, MAX}
This commit implements `SystemTime::MIN` and `SystemTime::MAX` for the UEFI platform. UEFI has a weird way to store times, i.e. a very complicated struct. The standard proclaims "1900-01-01T00:00:00+0000" to be the lowest possible value and `MAX_UEFI_TIME` is already present for the upper limit.
1 parent 31e588e commit 14600f6

File tree

1 file changed

+18
-0
lines changed
  • library/std/src/sys/pal/uefi

1 file changed

+18
-0
lines changed

library/std/src/sys/pal/uefi/time.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,24 @@ impl Instant {
6666
}
6767

6868
impl SystemTime {
69+
#[unstable(feature = "time_systemtime_limits", issue = "none")]
70+
pub const MAX: SystemTime = MAX_UEFI_TIME;
71+
72+
#[unstable(feature = "time_systemtime_limits", issue = "none")]
73+
pub const MIN: SystemTime = SystemTime::from_uefi(r_efi::efi::Time {
74+
year: 1900,
75+
month: 1,
76+
day: 1,
77+
hour: 0,
78+
minute: 0,
79+
second: 0,
80+
nanosecond: 0,
81+
timezone: -1440,
82+
daylight: 0,
83+
pad1: 0,
84+
pad2: 0,
85+
});
86+
6987
pub(crate) const fn from_uefi(t: r_efi::efi::Time) -> Self {
7088
Self(system_time_internal::from_uefi(&t))
7189
}

0 commit comments

Comments
 (0)