Skip to content

Commit

Permalink
add illumos support to v0.1
Browse files Browse the repository at this point in the history
illumos forked from Solaris around a decade ago, but is also currently
without the "tm_gmtoff" member.
  • Loading branch information
jclulow authored and pfmooney committed Apr 18, 2020
1 parent ebfb410 commit ae65abc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Utilities for working with time-related functions in Rust.
"""

[dependencies]
libc = "0.2.55"
libc = "0.2.69"
rustc-serialize = { version = "0.3", optional = true }

[target.'cfg(windows)'.dependencies]
Expand Down
10 changes: 5 additions & 5 deletions src/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ mod inner {
#[cfg(all(not(target_os = "macos"), not(target_os = "ios")))]
pub use self::unix::*;

#[cfg(target_os = "solaris")]
#[cfg(any(target_os = "solaris", target_os = "illumos"))]
extern {
static timezone: time_t;
static altzone: time_t;
Expand Down Expand Up @@ -252,7 +252,7 @@ mod inner {
rust_tm.tm_utcoff = utcoff;
}

#[cfg(any(target_os = "nacl", target_os = "solaris"))]
#[cfg(any(target_os = "nacl", target_os = "solaris", target_os = "illumos"))]
unsafe fn timegm(tm: *mut libc::tm) -> time_t {
use std::env::{set_var, var_os, remove_var};
extern {
Expand Down Expand Up @@ -295,7 +295,7 @@ mod inner {
if libc::localtime_r(&sec, &mut out).is_null() {
panic!("localtime_r failed: {}", io::Error::last_os_error());
}
#[cfg(target_os = "solaris")]
#[cfg(any(target_os = "solaris", target_os = "illumos"))]
let gmtoff = {
::tzset();
// < 0 means we don't know; assume we're not in DST.
Expand All @@ -308,7 +308,7 @@ mod inner {
-timezone
}
};
#[cfg(not(target_os = "solaris"))]
#[cfg(not(any(target_os = "solaris", target_os = "illumos")))]
let gmtoff = out.tm_gmtoff;
tm_to_rust_tm(&out, gmtoff as i32, tm);
}
Expand All @@ -317,7 +317,7 @@ mod inner {
pub fn utc_tm_to_time(rust_tm: &Tm) -> i64 {
#[cfg(all(target_os = "android", target_pointer_width = "32"))]
use libc::timegm64 as timegm;
#[cfg(not(any(all(target_os = "android", target_pointer_width = "32"), target_os = "nacl", target_os = "solaris")))]
#[cfg(not(any(all(target_os = "android", target_pointer_width = "32"), target_os = "nacl", target_os = "solaris", target_os = "illumos")))]
use libc::timegm;

let mut tm = unsafe { mem::zeroed() };
Expand Down

0 comments on commit ae65abc

Please sign in to comment.