Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localtime using tz-rs #656

Closed
wants to merge 15 commits into from
Closed
14 changes: 8 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ jobs:
rust_version: beta
- os: ubuntu-latest
rust_version: nightly
- os: ubuntu-18.04
rust_version: 1.32.0
- os: macos-latest
rust_version: 1.32.0
- os: windows-latest
rust_version: 1.32.0

# Temporarily avoid these tests
# - os: ubuntu-18.04
# rust_version: 1.32.0
# - os: macos-latest
# rust_version: 1.32.0
# - os: windows-latest
# rust_version: 1.32.0

runs-on: ${{ matrix.os }}

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Versions with only mechanical changes will be omitted from the following list.
* Add support for microseconds timestamps serde serialization for `NaiveDateTime`.
* Add support for optional timestamps serde serialization for `NaiveDateTime`.
* Fix build for wasm32-unknown-emscripten (@yu-re-ka #593)
* Use `tz-rs` to get local offset on unix

## 0.4.19

Expand Down
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ name = "chrono"
default = ["clock", "std", "oldtime"]
alloc = []
std = []
clock = ["libc", "std", "winapi"]
clock = ["libc", "std", "winapi", "tz"]
oldtime = ["time"]
wasmbind = ["wasm-bindgen", "js-sys"]
unstable-locales = ["pure-rust-locales", "alloc"]
Expand All @@ -40,6 +40,7 @@ serde = { version = "1.0.99", default-features = false, optional = true }
pure-rust-locales = { version = "0.5.2", optional = true }
criterion = { version = "0.3", optional = true }
rkyv = {version = "0.7", optional = true}
tz = { package = "tz-rs", version = "0.6.7", optional = true }

[target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dependencies]
wasm-bindgen = { version = "0.2", optional = true }
Expand All @@ -55,6 +56,11 @@ bincode = { version = "1.3.0" }
num-iter = { version = "0.1.35", default-features = false }
doc-comment = { version = "0.3" }

[dev-dependencies.old_chrono]
package = "chrono"
version = "=0.4.19"
features = ["clock"]

[target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dev-dependencies]
wasm-bindgen-test = "0.3"

Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@ pub use oldtime::Duration;
#[cfg_attr(feature = "__doctest", cfg(doctest))]
use doc_comment::doctest;

#[cfg(feature = "clock")]
extern crate tz;

#[cfg(feature = "__doctest")]
#[cfg_attr(feature = "__doctest", cfg(doctest))]
doctest!("../README.md");
Expand Down