const OS_HAS_THREAD_SAFE_ENVIRONMENT: bool = match std::env::consts::OS.as_bytes() {
b"illumos"
| b"netbsd"
| b"macos"
=> true,
_ => false,
};
#[inline]
pub(super) unsafe fn refresh_tz_unchecked() {
extern "C" {
#[cfg_attr(target_os = "netbsd", link_name = "__tzset50")]
fn tzset();
}
unsafe { tzset() };
}
#[inline]
pub(super) fn refresh_tz() -> Option<()> {
if OS_HAS_THREAD_SAFE_ENVIRONMENT || num_threads::is_single_threaded() == Some(true) {
unsafe { refresh_tz_unchecked() };
Some(())
} else {
None
}
}