Skip to content

Commit 45789f2

Browse files
committed
pal/solid: Implement SystemTime::{MIN, MAX}
This commit implements `SystemTime::MIN` and `SystemTime::MAX` for solid. The implementation uses a `time_t` to store the system time within a single value (i.e. no dual secs/nanosecs handling), thereby implying its `::MIN` and `::MAX` values as the respective boundaries.
1 parent eae0639 commit 45789f2

File tree

1 file changed

+6
-0
lines changed
  • library/std/src/sys/pal/solid

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ pub struct SystemTime(abi::time_t);
1010
pub const UNIX_EPOCH: SystemTime = SystemTime(0);
1111

1212
impl SystemTime {
13+
#[unstable(feature = "time_systemtime_limits", issue = "none")]
14+
pub const MAX: SystemTime = SystemTime(abi::time_t::MAX);
15+
16+
#[unstable(feature = "time_systemtime_limits", issue = "none")]
17+
pub const MIN: SystemTime = SystemTime(abi::time_t::MIN);
18+
1319
pub fn now() -> SystemTime {
1420
let rtc = unsafe {
1521
let mut out = MaybeUninit::zeroed();

0 commit comments

Comments
 (0)