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...
This commit is contained in:
joboet 2026-01-15 15:21:58 +01:00
parent 05bbfa2593
commit eec058eacc
No known key found for this signature in database
GPG key ID: 704E0149B0194B3C
3 changed files with 10 additions and 3 deletions

View file

@ -7,7 +7,6 @@
#![allow(dead_code)]
pub mod os;
#[allow(non_upper_case_globals)]
#[path = "../unix/time.rs"]
pub mod time;

View file

@ -1,4 +1,8 @@
cfg_select! {
target_os = "hermit" => {
mod hermit;
use hermit as imp;
}
target_os = "motor" => {
use moto_rt::time as imp;
}
@ -14,7 +18,11 @@ cfg_select! {
mod uefi;
use uefi as imp;
}
target_family = "unix" => {
any(
target_os = "teeos",
target_family = "unix",
target_os = "wasi",
) => {
mod unix;
use unix as imp;
}

View file

@ -15,7 +15,7 @@ impl SystemTime {
pub const MIN: SystemTime = SystemTime { t: Timespec::MIN };
#[cfg_attr(any(target_os = "horizon", target_os = "hurd"), allow(unused))]
#[cfg_attr(any(target_os = "horizon", target_os = "hurd", target_os = "teeos"), expect(unused))]
pub fn new(tv_sec: i64, tv_nsec: i64) -> Result<SystemTime, io::Error> {
Ok(SystemTime { t: Timespec::new(tv_sec, tv_nsec)? })
}