diff --git a/src/sys.rs b/src/sys.rs index d3923191..2e46b7e8 100644 --- a/src/sys.rs +++ b/src/sys.rs @@ -67,19 +67,6 @@ impl Timespec { } } -#[cfg(not(any(windows, target_env = "sgx")))] -#[allow(dead_code)] // only used on some architectures -pub fn tzset() { - extern "C" { - fn tzset(); - } - unsafe { tzset() } -} - -#[cfg(any(windows, target_env = "sgx"))] -#[allow(dead_code)] // only used on some architectures -pub fn tzset() {} - /// Holds a calendar date and time broken down into its components (year, month, /// day, and so on), also called a broken-down time value. // FIXME: use c_int instead of i32? diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 3539a90d..2f845e74 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -19,6 +19,14 @@ extern "C" { static altzone: time_t; } +#[cfg(any(target_os = "solaris", target_os = "illumos"))] +fn tzset() { + extern "C" { + fn tzset(); + } + unsafe { tzset() } +} + fn rust_tm_to_tm(rust_tm: &Tm, tm: &mut libc::tm) { tm.tm_sec = rust_tm.tm_sec; tm.tm_min = rust_tm.tm_min; @@ -78,7 +86,7 @@ pub fn time_to_local_tm(sec: i64, tm: &mut Tm) { } #[cfg(any(target_os = "solaris", target_os = "illumos"))] let gmtoff = { - ::oldtime::tzset(); + tzset(); // < 0 means we don't know; assume we're not in DST. if out.tm_isdst == 0 { // timezone is seconds west of UTC, tm_gmtoff is seconds east