Skip to content

Commit 01f05f7

Browse files
committed
std: move time implementations to sys (WASI/TEEOS)
WASI and TEEOS share the UNIX implementation. Since `Timespec` lives in the PAL, this means that the `#[path]` imports of `unix/time.rs` still remain for these two, unfortunately. Maybe we'll solve that in the future by always including the UNIX PAL for these remotely UNIXy platforms. But that's a story for another time...
1 parent 8bf5e44 commit 01f05f7

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

library/std/src/sys/pal/teeos/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#![allow(dead_code)]
88

99
pub mod os;
10-
#[allow(non_upper_case_globals)]
1110
#[path = "../unix/time.rs"]
1211
pub mod time;
1312

library/std/src/sys/time/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
cfg_select! {
2+
target_os = "hermit" => {
3+
mod hermit;
4+
use hermit as imp;
5+
}
26
target_os = "motor" => {
37
use moto_rt::time as imp;
48
}
@@ -14,7 +18,11 @@ cfg_select! {
1418
mod uefi;
1519
use uefi as imp;
1620
}
17-
target_family = "unix" => {
21+
any(
22+
target_os = "teeos",
23+
target_family = "unix",
24+
target_os = "wasi",
25+
) => {
1826
mod unix;
1927
use unix as imp;
2028
}

library/std/src/sys/time/unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ impl SystemTime {
1515

1616
pub const MIN: SystemTime = SystemTime { t: Timespec::MIN };
1717

18-
#[cfg_attr(any(target_os = "horizon", target_os = "hurd"), allow(unused))]
18+
#[cfg_attr(any(target_os = "horizon", target_os = "hurd", target_os = "teeos"), expect(unused))]
1919
pub fn new(tv_sec: i64, tv_nsec: i64) -> Result<SystemTime, io::Error> {
2020
Ok(SystemTime { t: Timespec::new(tv_sec, tv_nsec)? })
2121
}

0 commit comments

Comments
 (0)