mirror of
https://github.com/chronotope/chrono.git
synced 2025-10-02 15:26:12 +00:00
Tighten targets where tzset is defined
It doesn't need to be public in oldtime, and it is only used in the illumos/solaris environments.
This commit is contained in:
parent
f3bbc958a8
commit
f91e7e139c
13
src/sys.rs
13
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?
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user