Skip to content

Commit beca204

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 8cba2e8 commit beca204

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
@@ -39,6 +39,24 @@ const MAX_UEFI_TIME: SystemTime = SystemTime::from_uefi(r_efi::efi::Time {
3939
});
4040

4141
impl Instant {
42+
#[unstable(feature = "time_systemtime_limits", issue = "none")]
43+
pub const MAX: SystemTime = MAX_UEFI_TIME;
44+
45+
#[unstable(feature = "time_systemtime_limits", issue = "none")]
46+
pub const MIN: SystemTime = SystemTime::from_uefi(r_efi::efi::Time {
47+
year: 1900,
48+
month: 1,
49+
day: 1,
50+
hour: 0,
51+
minute: 0,
52+
second: 0,
53+
nanosecond: 0,
54+
timezone: 0,
55+
daylight: 0,
56+
pad1: 0,
57+
pad2: 0,
58+
});
59+
4260
pub fn now() -> Instant {
4361
// If we have a timestamp protocol, use it.
4462
if let Some(x) = instant_internal::timestamp_protocol() {

0 commit comments

Comments
 (0)