iana-time-zone-0.1.63/.cargo_vcs_info.json0000644000000001360000000000100137400ustar { "git": { "sha1": "6adcd016a82fc11e6ee6c1a7f8086d2330ea747a" }, "path_in_vcs": "" }iana-time-zone-0.1.63/.clang-format000064400000000000000000000001711046102023000151020ustar 00000000000000--- BasedOnStyle: Google IndentWidth: 4 ColumnLimit: 100 --- Language: Cpp SortIncludes: false TabWidth: 4 UseTab: Never iana-time-zone-0.1.63/.clippy.toml000064400000000000000000000000631046102023000150020ustar 00000000000000avoid-breaking-exported-api = true msrv = "1.62.0" iana-time-zone-0.1.63/.github/dependabot.yml000064400000000000000000000003101046102023000167120ustar 00000000000000version: 2 updates: - package-ecosystem: cargo directory: "/" schedule: interval: daily - package-ecosystem: github-actions directory: "/" schedule: interval: "daily" iana-time-zone-0.1.63/.github/workflows/rust.yml000064400000000000000000000316631046102023000176560ustar 00000000000000name: build on: push: branches: - main pull_request: branches: ["**"] schedule: # At 23:25 on Thursday. - cron: "25 23 * * 4" workflow_dispatch: permissions: {} jobs: test: strategy: fail-fast: false matrix: runs-on: [ubuntu-22.04, windows-2022, macos-13] toolchain: - "1.62" - stable - nightly versions: - "" - -Zminimal-versions exclude: # package `regex v1.11.1` cannot be built because it requires rustc # 1.65 or newer, while the currently active rustc version is 1.62.0 - toolchain: "1.62" versions: "" # Older proc-macro2 crates fail to compile on the latest nightly - toolchain: nightly versions: -Zminimal-versions runs-on: ${{ matrix.runs-on }} steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: | rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update rustup default ${{ matrix.toolchain }} - name: Update lockfile run: cargo generate-lockfile ${{ matrix.versions }} env: RUSTC_BOOTSTRAP: 1 - run: cargo test --all-targets - run: cargo run --example stress-test build-wasm: strategy: fail-fast: false matrix: versions: - "" - -Zminimal-versions toolchain: - stable - nightly include: # Without `-Zminimal-versions` a too recent bumpalo version is selected. Newer versions use `edition = "2021"`. - versions: -Zminimal-versions - toolchain: "1.62" runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: | rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update --target wasm32-unknown-unknown rustup default ${{ matrix.toolchain }} - name: Update lockfile run: cargo generate-lockfile ${{ matrix.versions }} env: RUSTC_BOOTSTRAP: 1 - run: cargo build --lib test-wasm: strategy: fail-fast: false matrix: toolchain: - stable - nightly runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: | rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update --target wasm32-unknown-unknown rustup default ${{ matrix.toolchain }} - name: Install Node uses: actions/setup-node@v4 with: node-version: "lts/*" - name: Install "wasm-pack" uses: taiki-e/install-action@v2 with: tool: wasm-pack - run: wasm-pack test --node build-cross: strategy: fail-fast: false matrix: target: - x86_64-unknown-freebsd - x86_64-unknown-illumos # # NetBSD disabled waiting for release with fix from # # https://github.com/cross-rs/cross/issues/1345 # - x86_64-unknown-netbsd # # Solaris disabled while https://github.com/cross-rs/cross/issues/1599 is open # - sparcv9-sun-solaris versions: - "" - -Zminimal-versions runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: | rustup toolchain install stable --profile minimal --no-self-update --target ${{ matrix.target }} - name: Update lockfile run: cargo generate-lockfile ${{ matrix.versions }} env: RUSTC_BOOTSTRAP: 1 - name: Install "cross" uses: taiki-e/install-action@v2 with: tool: cross - run: cross build --target ${{ matrix.target }} --examples build-android: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: rustup toolchain install stable --profile minimal --no-self-update - name: Add Rust components run: rustup component add clippy rust-src - name: Add Rust toolchain run: rustup target add aarch64-linux-android armv7-linux-androideabi - name: Setup Android NDK uses: nttld/setup-ndk@v1 id: setup-ndk with: ndk-version: r25b local-cache: true - name: Install "cargo ndk" uses: taiki-e/install-action@v2 with: tool: cargo-ndk - name: Check run: cargo ndk check --lib env: ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} - name: Clippy run: cargo ndk clippy --lib env: ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} - name: Build library run: cargo ndk build --lib env: ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} build-ios-cross: strategy: fail-fast: false matrix: toolchain: - "1.62" - stable target: - x86_64-apple-ios versions: - "" - -Zminimal-versions exclude: # package `regex v1.11.1` cannot be built because it requires rustc # 1.65 or newer, while the currently active rustc version is 1.62.0 - toolchain: "1.62" versions: "" runs-on: macos-13 steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: | rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update --target ${{ matrix.target }} rustup default ${{ matrix.toolchain }} - name: Update lockfile run: cargo generate-lockfile ${{ matrix.versions }} env: RUSTC_BOOTSTRAP: 1 - name: Install "cross" run: curl --location --silent --show-error --fail https://github.com/cargo-bins/cargo-quickinstall/releases/download/cross-0.2.5-x86_64-apple-darwin/cross-0.2.5-x86_64-apple-darwin.tar.gz | tar -xzvvf - -C $HOME/.cargo/bin - run: cross build --target ${{ matrix.target }} --examples check: strategy: fail-fast: false matrix: toolchain: - "1.62" - stable - nightly versions: - "" - -Zminimal-versions exclude: # package `cc v1.2.17` cannot be built because it requires rustc 1.63 # or newer, while the currently active rustc version is 1.62.0 - toolchain: "1.62" versions: "" runs-on: ubuntu-latest env: RUSTFLAGS: -D warnings RUST_BACKTRACE: 1 steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: | rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update --component clippy rustup default ${{ matrix.toolchain }} - name: Update lockfile run: cargo generate-lockfile ${{ matrix.versions }} env: RUSTC_BOOTSTRAP: 1 - run: cargo check --all-targets --workspace - run: cargo clippy --all-targets --workspace -- -D warnings no-docker-image-check-only: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: | rustup toolchain install nightly --profile minimal --no-self-update --component rust-src rustup default nightly - run: cargo check --target x86_64-unknown-haiku -Z build-std --examples doc: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: | rustup toolchain install nightly --profile minimal --no-self-update rustup default nightly - run: RUSTDOCFLAGS="-D warnings" cargo doc --all-features audit: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - uses: EmbarkStudios/cargo-deny-action@v2 fallback: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: | rustup toolchain install stable --profile minimal --no-self-update --target x86_64-fortanix-unknown-sgx # Should fail (outcome is negated): - run: if cargo build --lib --target x86_64-fortanix-unknown-sgx; then exit 1; fi # Should succeed: - run: cargo build --lib --target x86_64-fortanix-unknown-sgx --features fallback c: name: Lint and format C runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: persist-credentials: false - name: Setup Node.js runtime uses: actions/setup-node@v4 with: node-version: "lts/*" - name: Install npm run: npm i -f -g npm@8.16.0 - name: Lint and check formatting with clang-format run: npx github:artichoke/clang-format --check test-haiku: strategy: fail-fast: false matrix: runs-on: [ubuntu-22.04, windows-2022, macos-13] toolchain: - stable versions: - "" runs-on: ${{ matrix.runs-on }} env: RUSTFLAGS: -D warnings RUST_BACKTRACE: 1 steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: | rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update --target x86_64-fortanix-unknown-sgx rustup default ${{ matrix.toolchain }} - name: Update lockfile run: cargo generate-lockfile ${{ matrix.versions }} working-directory: haiku env: RUSTC_BOOTSTRAP: 1 - run: cargo test --all-targets working-directory: haiku check-haiku: strategy: fail-fast: false matrix: toolchain: - stable versions: - "" runs-on: ubuntu-latest env: RUSTFLAGS: -D warnings RUST_BACKTRACE: 1 steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: | rustup toolchain install ${{ matrix.toolchain }} --profile minimal --no-self-update --component clippy rustup default ${{ matrix.toolchain }} - name: Update lockfile run: cargo generate-lockfile ${{ matrix.versions }} working-directory: haiku env: RUSTC_BOOTSTRAP: 1 - run: cargo check --all-targets working-directory: haiku - run: cargo clippy --all-targets -- -D warnings working-directory: haiku check-all-versions: runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v4 with: persist-credentials: false - name: Install Rust run: | rustup toolchain install nightly --profile minimal --no-self-update rustup default nightly - name: Install "cargo hack" uses: taiki-e/install-action@v2 with: tool: cargo-hack - run: cargo hack check --version-range .. --version-step 2 --clean-per-version --clean-per-run generate-windows-bindings: name: Generate windows-core bindings with windows-bindgen runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: persist-credentials: false - name: Clean run: rm -rf src/Windows.rs - name: Generate run: cargo r --manifest-path=api_gen/Cargo.toml - name: Diff generated Rust code run: test -z "$(git status --porcelain)" || (echo "::error::Generated files are different, please regenerate with cargo run --manifest-path=api_gen/Cargo.toml!"; git status; false) typos: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: persist-credentials: false - uses: crate-ci/typos@master devskim: runs-on: ubuntu-latest permissions: actions: read contents: read security-events: write steps: - uses: actions/checkout@v4 with: persist-credentials: false - name: Run DevSkim scanner uses: microsoft/DevSkim-Action@v1 - name: Upload DevSkim scan results to GitHub Security tab uses: github/codeql-action/upload-sarif@v3 with: sarif_file: devskim-results.sarif iana-time-zone-0.1.63/.github/workflows/zizmor.yaml000064400000000000000000000014311046102023000203420ustar 00000000000000name: GitHub Actions Security Analysis with zizmor 🌈 on: push: branches: ["main"] pull_request: branches: ["**"] permissions: {} jobs: zizmor: name: zizmor latest via PyPI runs-on: ubuntu-latest permissions: security-events: write steps: - name: Checkout repository uses: actions/checkout@v4 with: persist-credentials: false - name: Install the latest version of uv uses: astral-sh/setup-uv@v5 - name: Run zizmor 🌈 run: uvx zizmor --format sarif . > results.sarif env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload SARIF file uses: github/codeql-action/upload-sarif@v3 with: sarif_file: results.sarif category: zizmor iana-time-zone-0.1.63/.gitignore000064400000000000000000000000221046102023000145120ustar 00000000000000target Cargo.lock iana-time-zone-0.1.63/CHANGELOG.md000064400000000000000000000370211046102023000143440ustar 00000000000000# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [0.1.63] - 2025-03-31 ### Changes - Bump MSRV (minimum supported rust version) to 1.62 ([#131](https://github.com/strawlab/iana-time-zone/pull/131)) - Bump `windows-core` to `0.56-0.61` range ([#131](https://github.com/strawlab/iana-time-zone/pull/131), [#133](https://github.com/strawlab/iana-time-zone/pull/133)) ## [0.1.62] - 2025-03-24 ### Changed - Bump MSRV (minimum supported rust version) to 1.61 ([#157](https://github.com/strawlab/iana-time-zone/pull/157)) - Update to rust edition 2021 ([#161](https://github.com/strawlab/iana-time-zone/pull/161)) - Address high and medium severity zizmor findings ([#163](https://github.com/strawlab/iana-time-zone/pull/163)) ### Added - Added support for tvOS, watchOS and visionOS ([#146](https://github.com/strawlab/iana-time-zone/pull/146)). - implement OpenHarmony support ([#150](https://github.com/strawlab/iana-time-zone/pull/150)) ## [0.1.61] - 2024-09-16 ### Changed - Depend on wasm-bindgen 0.2.89 or higher ([#134](https://github.com/strawlab/iana-time-zone/pull/134)) - Do not use wasm_bindgen in wasm32-unknown-emscripten environment ([#130](https://github.com/strawlab/iana-time-zone/pull/130)) ## [0.1.60] - 2024-02-03 ### Changed - correct `windows-core` dependency version ([#127](https://github.com/strawlab/iana-time-zone/pull/127)) ## [0.1.59] - 2023-12-30 ### Changed - update `windows` dependency ([#125](https://github.com/strawlab/iana-time-zone/pull/125)) ## [0.1.58] - 2023-10-17 ### Added - use windows-core with embedded bindings via windows-bindgen ([#117](https://github.com/strawlab/iana-time-zone/pull/117)) - implement GNU Hurd support ([#121](https://github.com/strawlab/iana-time-zone/pull/121)) - implement AIX support ([#57](https://github.com/strawlab/iana-time-zone/pull/57)) ## [0.1.57] - 2023-06-07 ### Added - implement OpenWRT support ([#109](https://github.com/strawlab/iana-time-zone/pull/109)) ## [0.1.56] - 2023-04-03 ### Changed - update `windows` dependency ([#102](https://github.com/strawlab/iana-time-zone/pull/102)) ## [0.1.55] - 2023-03-30 ### Changed - update `windows` dependency ([#101](https://github.com/strawlab/iana-time-zone/pull/101)) ## [0.1.54] - 2023-03-21 ### Changed - replace `winapi` dependency with `windows` ([#97](https://github.com/strawlab/iana-time-zone/pull/97)) - bump msrv to 1.48 ([#91](https://github.com/strawlab/iana-time-zone/pull/91)) ## [0.1.53] - 2022-10-28 ### Fixed - remove lint causing breakage on rust 1.45-1.51 ([#84](https://github.com/strawlab/iana-time-zone/pull/84)) ## [0.1.52] - 2022-10-28 ### Fixed - fix for NixOS ([#81](https://github.com/strawlab/iana-time-zone/pull/81)) ### Changed - allow building the haiku crate on other hosts([#75](https://github.com/strawlab/iana-time-zone/pull/75)) - various improvements in continuous integration and source quality ([#76](https://github.com/strawlab/iana-time-zone/pull/76)), ([#77](https://github.com/strawlab/iana-time-zone/pull/77)), ([#78](https://github.com/strawlab/iana-time-zone/pull/78)), ([#81](https://github.com/strawlab/iana-time-zone/pull/81)) ## [0.1.51] - 2022-10-08 ### Changed - bump MSRV to 1.38 ([#70](https://github.com/strawlab/iana-time-zone/pull/70)) - Refactor Android property key CStr construction to add tests ([#69](https://github.com/strawlab/iana-time-zone/pull/69)) - Refactor MacOS implementation a lot ([#67](https://github.com/strawlab/iana-time-zone/pull/67)) ### Added - Implement for Haiku ([#66](https://github.com/strawlab/iana-time-zone/pull/66)) ### Fixed - Fix spelling of 'initialized' in sync::Once statics ([#63](https://github.com/strawlab/iana-time-zone/pull/63)) ## [0.1.50] - 2022-09-23 ### Fixed - Reduce MSRV for Android again ([#62](https://github.com/strawlab/iana-time-zone/pull/62)) ## [0.1.49] - 2022-09-22 ### Changed - `once_cell` dependency is not needed ([#61](https://github.com/strawlab/iana-time-zone/pull/61)) ## [0.1.48] - 2022-09-12 ### Changed - Downgrade requirements for WASM dependencies ([#58](https://github.com/strawlab/iana-time-zone/pull/58)) - Reduce MSRV for Tier 1 platforms to 1.31 ([#59](https://github.com/strawlab/iana-time-zone/pull/59)) ## [0.1.47] - 2022-08-30 ### Changed - Update `android_system_properties` to v0.1.5 to run 9786% faster (YMMV) ([#56](https://github.com/strawlab/iana-time-zone/pull/56)) ## [0.1.46] - 2022-08-18 ### Added - Implement for Solaris ([#55](https://github.com/strawlab/iana-time-zone/pull/55)) ## [0.1.45] - 2022-08-16 ### Fixed - Fix potential use after free in MacOS / iOS ([#54](https://github.com/strawlab/iana-time-zone/pull/54), [RUSTSEC-2022-0049](https://rustsec.org/advisories/RUSTSEC-2022-0049.html)) - Fix typos in README ([#53](https://github.com/strawlab/iana-time-zone/pull/53)) ## [0.1.44] - 2022-08-11 ### Fixed - "/etc/localtime" may be relative link ([#49](https://github.com/strawlab/iana-time-zone/pull/49)) ## [0.1.43] - 2022-08-11 ### Changed - Use `core-foundation-sys` instead of `core-foundation` ([#50](https://github.com/strawlab/iana-time-zone/pull/50)) ## [0.1.42] - 2022-08-10 ### Fixed - Fix implementation for Redhat based distros ([#48](https://github.com/strawlab/iana-time-zone/pull/48)) ## [0.1.41] - 2022-08-02 ### Added - Add `fallback` feature ([#46](https://github.com/strawlab/iana-time-zone/pull/46)) ## [0.1.40] - 2022-07-29 ### Added - Implement for Android ([#45](https://github.com/strawlab/iana-time-zone/pull/45)) ## [0.1.38] - 2022-07-27 ### Added - Implement illumos ([#44](https://github.com/strawlab/iana-time-zone/pull/44)) ### Changed - Update examples in README ## [0.1.37] - 2022-07-23 ### Added - Support iOS ([#41](https://github.com/strawlab/iana-time-zone/pull/41)) ### Changed - Implement `std::err::source()`, format `IoError` ([#42](https://github.com/strawlab/iana-time-zone/pull/42)) ## [0.1.36] - 2022-07-21 ### Fixed - Fail to compile for WASI ([#40](https://github.com/strawlab/iana-time-zone/pull/40)) ## [0.1.35] - 2022-06-29 ### Added - Implement for FreeBSD, NetBSD, OpenBSD and Dragonfly ([#39](https://github.com/strawlab/iana-time-zone/pull/39)) ## [0.1.34] - 2022-06-29 ### Added - Implement for wasm32 ([#38](https://github.com/strawlab/iana-time-zone/pull/38)) ## [0.1.33] - 2022-04-15 ### Changed - Use `winapi` crate instead of `windows` crate ([#35](https://github.com/strawlab/iana-time-zone/pull/35)) ## [0.1.32] - 2022-04-06 ### Changed - Update `windows` requirement from 0.34 to 0.35 ([#34](https://github.com/strawlab/iana-time-zone/pull/34)) ## [0.1.31] - 2022-03-16 ### Changed - Update `windows` requirement from 0.33 to 0.34 ([#33](https://github.com/strawlab/iana-time-zone/pull/33)) ## [0.1.30] - 2022-02-28 ### Changed - Fewer string allocations ([#32](https://github.com/strawlab/iana-time-zone/pull/32)) ## [0.1.29] - 2022-02-25 ### Changed - Update `windows` requirement from 0.32 to 0.33 ([#31](https://github.com/strawlab/iana-time-zone/pull/31)) ## [0.1.28] - 2022-02-04 ### Changed - Update `windows` requirement from 0.30 to 0.32 ([#30](https://github.com/strawlab/iana-time-zone/pull/30)) ## [0.1.27] - 2022-01-14 ### Changed - Update `windows` requirement from 0.29 to 0.30 ([#29](https://github.com/strawlab/iana-time-zone/pull/29)) ## [0.1.26] - 2021-12-23 ### Changed - Update `windows` requirement from 0.28 to 0.29 ([#28](https://github.com/strawlab/iana-time-zone/pull/28)) ## [0.1.25] - 2021-11-18 ### Changed - Update `windows` requirement from 0.27 to 0.28 ([#27](https://github.com/strawlab/iana-time-zone/pull/27)) ## [0.1.24] - 2021-11-16 ### Changed - Update `windows` requirement from 0.26 to 0.27 ([#26](https://github.com/strawlab/iana-time-zone/pull/26)) ## [0.1.23] - 2021-11-12 ### Changed - Update `windows` requirement from 0.25 to 0.26 ([#25](https://github.com/strawlab/iana-time-zone/pull/25)) ## [0.1.22] - 2021-11-08 ### Changed - Update `windows` requirement from 0.24 to 0.25 ([#24](https://github.com/strawlab/iana-time-zone/pull/24)) ## [0.1.21] - 2021-11-02 ### Changed - Update `windows` requirement from 0.23 to 0.24 ([#23](https://github.com/strawlab/iana-time-zone/pull/23)) ## [0.1.20] - 2021-10-29 ### Changed - Update `windows` requirement from 0.21 to 0.23 ([#22](https://github.com/strawlab/iana-time-zone/pull/22)) ## [0.1.19] - 2021-09-27 ### Changed - Update `windows` requirement from 0.19 to 0.21 ([#18](https://github.com/strawlab/iana-time-zone/pull/18), [#20](https://github.com/strawlab/iana-time-zone/pull/20)) - Update `chrono-tz` requirement from 0.5 to 0.6 ([#19](https://github.com/strawlab/iana-time-zone/pull/19)) ## [0.1.18] - 2021-08-23 ### Changed - Update `windows` requirement from 0.18 to 0.19 ([#17](https://github.com/strawlab/iana-time-zone/pull/17)) ## [0.1.16] - 2021-07-26 ### Changed - Update `windows` requirement from 0.17 to 0.18 ([#16](https://github.com/strawlab/iana-time-zone/pull/16)) ## [0.1.15] - 2021-07-08 ### Changed - Update `windows` requirement from 0.14 to 0.17 ([#15](https://github.com/strawlab/iana-time-zone/pull/15)) ## [0.1.14] - 2021-07-07 ### Changed - Update `windows` requirement from 0.13 to 0.14 ([#14](https://github.com/strawlab/iana-time-zone/pull/14)) ## [0.1.13] - 2021-06-28 ### Changed - Update `windows` requirement from 0.12 to 0.13 ([#13](https://github.com/strawlab/iana-time-zone/pull/13)) ## [0.1.12] - 2021-06-28 ### Changed - Update `windows` requirement from 0.11 to 0.12 ([#12](https://github.com/strawlab/iana-time-zone/pull/12)) ## [0.1.11] - 2021-06-12 ### Changed - Update `windows` requirement from 0.10 to 0.11 ([#11](https://github.com/strawlab/iana-time-zone/pull/11)) ## [0.1.10] - 2021-05-13 ### Changed - Update `windows` requirement from 0.9 to 0.10 ([#10](https://github.com/strawlab/iana-time-zone/pull/10)) ## [0.1.9] - 2021-04-28 ### Changed - Update `windows` requirement from 0.8 to 0.9 ([#8](https://github.com/strawlab/iana-time-zone/pull/8)) ## [0.1.8] - 2021-04-13 ### Changed - Update `windows` requirement from 0.7 to 0.8 ([#7](https://github.com/strawlab/iana-time-zone/pull/7)) ## [0.1.7] - 2021-03-30 ### Changed - Update `windows` requirement from 0.6 to 0.7 ([#6](https://github.com/strawlab/iana-time-zone/pull/6)) ## [0.1.6] - 2021-03-24 ### Changed - Update `windows` requirement from 0.5 to 0.6 ([#5](https://github.com/strawlab/iana-time-zone/pull/5)) ## [0.1.5] - 2021-03-20 ### Changed - Update `windows` requirement from 0.4 to 0.5 ([#4](https://github.com/strawlab/iana-time-zone/pull/4)) ## [0.1.4] - 2021-03-11 ### Changed - Update `windows` requirement from 0.3 to 0.4 ([#3](https://github.com/strawlab/iana-time-zone/pull/3)) ## [0.1.3] - 2021-02-22 ### Changed - Use `windows` crate instead of `winrt` ## [0.1.2] - 2020-10-09 ### Changed - Update `core-foundation` requirement from 0.7 to 0.9 ([#1](https://github.com/strawlab/iana-time-zone/pull/1)) ## [0.1.1] - 2020-06-27 ### Changed - Update `core-foundation` requirement from 0.5 to 0.7 ## [0.1.0] - 2020-06-27 ### Added - Implement for Linux, Windows, MacOS [0.1.63]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.63 [0.1.62]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.62 [0.1.61]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.61 [0.1.60]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.60 [0.1.59]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.59 [0.1.58]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.58 [0.1.57]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.57 [0.1.56]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.56 [0.1.55]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.55 [0.1.54]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.54 [0.1.53]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.53 [0.1.52]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.52 [0.1.51]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.51 [0.1.50]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.50 [0.1.49]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.49 [0.1.48]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.48 [0.1.47]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.47 [0.1.46]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.46 [0.1.45]: https://github.com/strawlab/iana-time-zone/releases/tag/v0.1.45 [0.1.44]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.44 [0.1.43]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.43 [0.1.42]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.42 [0.1.41]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.41 [0.1.40]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.40 [0.1.39]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.39 [0.1.38]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.38 [0.1.37]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.37 [0.1.36]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.36 [0.1.35]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.35 [0.1.34]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.34 [0.1.33]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.33 [0.1.32]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.32 [0.1.31]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.31 [0.1.30]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.30 [0.1.29]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.29 [0.1.28]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.28 [0.1.27]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.27 [0.1.26]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.26 [0.1.25]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.25 [0.1.24]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.24 [0.1.23]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.23 [0.1.22]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.22 [0.1.21]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.21 [0.1.20]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.20 [0.1.19]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.19 [0.1.18]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.18 [0.1.17]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.17 [0.1.16]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.16 [0.1.15]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.15 [0.1.14]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.14 [0.1.13]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.13 [0.1.12]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.12 [0.1.11]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.11 [0.1.10]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.10 [0.1.9]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.9 [0.1.8]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.8 [0.1.7]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.7 [0.1.6]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.6 [0.1.5]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.5 [0.1.4]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.4 [0.1.3]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.3 [0.1.2]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.2 [0.1.1]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.1 [0.1.0]: https://github.com/strawlab/iana-time-zone/releases/tag/0.1.0 iana-time-zone-0.1.63/Cargo.lock0000644000000362040000000000100117200ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "aho-corasick" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "android_system_properties" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" dependencies = [ "libc", ] [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bumpalo" version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "cc" version = "1.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" dependencies = [ "shlex", ] [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "num-traits", ] [[package]] name = "chrono-tz" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efdce149c370f133a071ca8ef6ea340b7b88748ab0810097a9e2976eaa34b4f3" dependencies = [ "chrono", "chrono-tz-build", "phf", ] [[package]] name = "chrono-tz-build" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f10f8c9340e31fc120ff885fcdb54a0b48e474bbd77cab557f0c30a3e569402" dependencies = [ "parse-zoneinfo", "phf_codegen", ] [[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "getrandom" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", "libc", "wasi", "wasm-bindgen", ] [[package]] name = "iana-time-zone" version = "0.1.63" dependencies = [ "android_system_properties", "chrono-tz", "core-foundation-sys", "getrandom", "iana-time-zone-haiku", "js-sys", "log", "wasm-bindgen", "wasm-bindgen-test", "windows-core", ] [[package]] name = "iana-time-zone-haiku" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ "cc", ] [[package]] name = "js-sys" version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", ] [[package]] name = "libc" version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "log" version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "memchr" version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "minicov" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27fe9f1cc3c22e1687f9446c2083c4c5fc7f0bcf1c7a86bdbded14985895b4b" dependencies = [ "cc", "walkdir", ] [[package]] name = "num-traits" version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "parse-zoneinfo" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24" dependencies = [ "regex", ] [[package]] name = "phf" version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" dependencies = [ "phf_shared", ] [[package]] name = "phf_codegen" version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" dependencies = [ "phf_generator", "phf_shared", ] [[package]] name = "phf_generator" version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" dependencies = [ "phf_shared", "rand", ] [[package]] name = "phf_shared" version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ "siphasher", ] [[package]] name = "proc-macro2" version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] [[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "rand_core", ] [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] name = "regex" version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", "regex-automata", "regex-syntax", ] [[package]] name = "regex-automata" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustversion" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ "winapi-util", ] [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "siphasher" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "syn" version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "unicode-ident" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "walkdir" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", ] [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", "proc-macro2", "quote", "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" dependencies = [ "unicode-ident", ] [[package]] name = "wasm-bindgen-test" version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66c8d5e33ca3b6d9fa3b4676d774c5778031d27a578c2b007f905acf816152c3" dependencies = [ "js-sys", "minicov", "wasm-bindgen", "wasm-bindgen-futures", "wasm-bindgen-test-macro", ] [[package]] name = "wasm-bindgen-test-macro" version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17d5042cc5fa009658f9a7333ef24291b1291a25b6382dd68862a7f3b969f69b" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "web-sys" version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] name = "winapi-util" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ "windows-sys", ] [[package]] name = "windows-core" version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" dependencies = [ "windows-implement", "windows-interface", "windows-link", "windows-result", "windows-strings", ] [[package]] name = "windows-implement" version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "windows-interface" version = "0.59.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "windows-link" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] name = "windows-result" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" dependencies = [ "windows-link", ] [[package]] name = "windows-strings" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" dependencies = [ "windows-link", ] [[package]] name = "windows-sys" version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" iana-time-zone-0.1.63/Cargo.toml0000644000000046010000000000100117370ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" rust-version = "1.62.0" name = "iana-time-zone" version = "0.1.63" authors = [ "Andrew Straw ", "René Kijewski ", "Ryan Lopopolo ", ] build = false autolib = false autobins = false autoexamples = false autotests = false autobenches = false description = "get the IANA time zone for the current system" readme = "README.md" keywords = [ "IANA", "time", ] categories = [ "date-and-time", "internationalization", "os", ] license = "MIT OR Apache-2.0" repository = "https://github.com/strawlab/iana-time-zone" [features] fallback = [] [lib] name = "iana_time_zone" path = "src/lib.rs" [[example]] name = "get_timezone" path = "examples/get_timezone.rs" [[example]] name = "get_timezone_loop" path = "examples/get_timezone_loop.rs" [[example]] name = "stress-test" path = "examples/stress-test.rs" [dev-dependencies.chrono-tz] version = "0.10.1" [dev-dependencies.getrandom] version = "0.2.1" [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies.js-sys] version = "0.3.66" [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies.log] version = "0.4.14" [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies.wasm-bindgen] version = "0.2.89" [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies.getrandom] version = "0.2.1" features = ["js"] [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies.wasm-bindgen-test] version = "0.3.46" [target.'cfg(target_os = "android")'.dependencies.android_system_properties] version = "0.1.5" [target.'cfg(target_os = "haiku")'.dependencies.iana-time-zone-haiku] version = "0.1.1" [target.'cfg(target_os = "windows")'.dependencies.windows-core] version = ">=0.56, <=0.61" [target.'cfg(target_vendor = "apple")'.dependencies.core-foundation-sys] version = "0.8.6" iana-time-zone-0.1.63/Cargo.toml.orig000064400000000000000000000034171046102023000154240ustar 00000000000000[package] name = "iana-time-zone" description = "get the IANA time zone for the current system" version = "0.1.63" authors = [ "Andrew Straw ", "René Kijewski ", "Ryan Lopopolo ", ] repository = "https://github.com/strawlab/iana-time-zone" license = "MIT OR Apache-2.0" keywords = ["IANA", "time"] categories = ["date-and-time", "internationalization", "os"] readme = "README.md" edition = "2021" rust-version = "1.62.0" [features] # When enabled, the library will succeed to compile for unknown target platforms, and return an `Err(GetTimezoneError::OsError)` at runtime. fallback = [] [target.'cfg(target_os = "android")'.dependencies] android_system_properties = "0.1.5" [target.'cfg(target_vendor = "apple")'.dependencies] core-foundation-sys = "0.8.6" [target.'cfg(target_os = "windows")'.dependencies] windows-core = ">=0.56, <=0.61" [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] js-sys = "0.3.66" # Set a minimum, but unused, dependency on `log` to ensure that cfg-if 1.0.0 # gets pulled in in a minimal versions build for the indirect dependency from # `wasm-bindgen`. log = "0.4.14" wasm-bindgen = "0.2.89" [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies] wasm-bindgen-test = "0.3.46" getrandom = { version = "0.2.1", features = ["js"] } [target.'cfg(target_os = "haiku")'.dependencies] iana-time-zone-haiku = { version = "0.1.1", path = "haiku" } [dev-dependencies] chrono-tz = "0.10.1" # Set a minimum, but unused, dependency on `getrandom` to ensure that cfg-if # 1.0.0 gets pulled in in a minimal versions build for the indirect dependency # from `chrono`. getrandom = "0.2.1" [workspace] members = [".", "haiku"] default-members = ["."] iana-time-zone-0.1.63/LICENSE-APACHE000064400000000000000000000251201046102023000144540ustar 00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2020 Andrew Straw Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. iana-time-zone-0.1.63/LICENSE-MIT000064400000000000000000000020431046102023000141630ustar 00000000000000Copyright (c) 2020 Andrew D. Straw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. iana-time-zone-0.1.63/README.md000064400000000000000000000035231046102023000140120ustar 00000000000000# iana-time-zone - get the IANA time zone for the current system [![Crates.io](https://img.shields.io/crates/v/iana-time-zone.svg)](https://crates.io/crates/iana-time-zone) [![Documentation](https://docs.rs/iana-time-zone/badge.svg)](https://docs.rs/iana-time-zone/) [![Crate License](https://img.shields.io/crates/l/iana-time-zone.svg)](https://crates.io/crates/iana-time-zone) [![build](https://github.com/strawlab/iana-time-zone/actions/workflows/rust.yml/badge.svg)](https://github.com/strawlab/iana-time-zone/actions?query=branch%3Amain) This small utility crate gets the IANA time zone for the current system. This is also known as the [tz database], tzdata, the zoneinfo database, and the Olson database. [tz database]: https://en.wikipedia.org/wiki/Tz_database Example: ```rust // Get the current time zone as a string. let tz_str = iana_time_zone::get_timezone()?; println!("The current time zone is: {}", tz_str); ``` You can test this is working on your platform with: ``` cargo run --example get_timezone ``` ## Minimum supported rust version policy This crate has a minimum supported rust version (MSRV) of 1.62.0 for [Tier 1] platforms. [tier 1]: https://doc.rust-lang.org/1.62.0/rustc/platform-support.html Updates to the MSRV are sometimes necessary due to the MSRV of dependencies. MSRV updates will not be indicated as a breaking change to the semver version. ## License Licensed under either of - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or ) - MIT license ([LICENSE-MIT](LICENSE-MIT) or ) at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. iana-time-zone-0.1.63/bindings.txt000064400000000000000000000001131046102023000150610ustar 00000000000000--out src/windows_bindings.rs --filter Windows.Globalization.Calendar iana-time-zone-0.1.63/deny.toml000064400000000000000000000001401046102023000143570ustar 00000000000000[licenses] version = 2 allow = ["Apache-2.0", "MIT", "Unicode-3.0"] private = { ignore = true } iana-time-zone-0.1.63/examples/get_timezone.rs000064400000000000000000000002251046102023000174040ustar 00000000000000use iana_time_zone::{get_timezone, GetTimezoneError}; fn main() -> Result<(), GetTimezoneError> { println!("{}", get_timezone()?); Ok(()) } iana-time-zone-0.1.63/examples/get_timezone_loop.rs000064400000000000000000000004271046102023000204410ustar 00000000000000use std::thread; use std::time::Duration; use iana_time_zone::{get_timezone, GetTimezoneError}; const WAIT: Duration = Duration::from_secs(1); fn main() -> Result<(), GetTimezoneError> { loop { println!("{}", get_timezone()?); thread::sleep(WAIT); } } iana-time-zone-0.1.63/examples/stress-test.rs000064400000000000000000000012041046102023000172110ustar 00000000000000use std::sync::atomic::{AtomicUsize, Ordering}; use std::thread::spawn; use iana_time_zone::get_timezone; const THREADS: usize = 10; const ITERATIONS: usize = 100_000; static COUNT: AtomicUsize = AtomicUsize::new(0); fn main() { let mut threads = Vec::with_capacity(THREADS); for _ in 0..THREADS { threads.push(spawn(|| { for _ in 0..ITERATIONS { get_timezone().unwrap(); COUNT.fetch_add(1, Ordering::Relaxed); } })); } for thread in threads { thread.join().unwrap(); } assert_eq!(COUNT.load(Ordering::SeqCst), THREADS * ITERATIONS); } iana-time-zone-0.1.63/src/ffi_utils.rs000064400000000000000000000467361046102023000156710ustar 00000000000000//! Cross platform FFI helpers. #[cfg(any(test, target_os = "android"))] use std::ffi::CStr; /// A buffer to store the timezone name when calling the C API. #[cfg(any(test, target_vendor = "apple", target_env = "ohos"))] pub(crate) mod buffer { /// The longest name in the IANA time zone database is 32 ASCII characters long. pub const MAX_LEN: usize = 64; /// Return a buffer to store the timezone name. /// /// The buffer is used to store the timezone name when calling the C API. pub const fn tzname_buf() -> [u8; MAX_LEN] { [0; MAX_LEN] } } // The system property named 'persist.sys.timezone' contains the name of the // current timezone. // // From https://android.googlesource.com/platform/bionic/+/gingerbread-release/libc/docs/OVERVIEW.TXT#79: // // > The name of the current timezone is taken from the TZ environment variable, // > if defined. Otherwise, the system property named 'persist.sys.timezone' is // > checked instead. // // TODO: Use a `c"..."` literal when MSRV is upgraded beyond 1.77.0. // https://doc.rust-lang.org/edition-guide/rust-2021/c-string-literals.html #[cfg(any(test, target_os = "android"))] const ANDROID_TIMEZONE_PROPERTY_NAME: &[u8] = b"persist.sys.timezone\0"; /// Return a [`CStr`] to access the timezone from an Android system properties /// environment. #[cfg(any(test, target_os = "android"))] pub(crate) fn android_timezone_property_name() -> &'static CStr { // In tests or debug mode, opt into extra runtime checks. if cfg!(any(test, debug_assertions)) { return CStr::from_bytes_with_nul(ANDROID_TIMEZONE_PROPERTY_NAME).unwrap(); } // SAFETY: the key is NUL-terminated and there are no other NULs, this // invariant is checked in tests. unsafe { CStr::from_bytes_with_nul_unchecked(ANDROID_TIMEZONE_PROPERTY_NAME) } } #[cfg(test)] mod tests { use core::mem::size_of_val; use std::ffi::CStr; use super::buffer::{tzname_buf, MAX_LEN}; use super::{android_timezone_property_name, ANDROID_TIMEZONE_PROPERTY_NAME}; #[test] fn test_android_timezone_property_name_is_valid_cstr() { CStr::from_bytes_with_nul(ANDROID_TIMEZONE_PROPERTY_NAME).unwrap(); let mut invalid_property_name = ANDROID_TIMEZONE_PROPERTY_NAME.to_owned(); invalid_property_name.push(b'\0'); CStr::from_bytes_with_nul(&invalid_property_name).unwrap_err(); } #[test] fn test_android_timezone_property_name_getter() { let key = android_timezone_property_name().to_bytes_with_nul(); assert_eq!(key, ANDROID_TIMEZONE_PROPERTY_NAME); std::str::from_utf8(key).unwrap(); } /// An exhaustive set of IANA timezone names for testing. /// /// Pulled from Wikipedia as of Sat March 22, 2025: /// /// - /// - static KNOWN_TIMEZONE_NAMES: &[&str] = &[ "Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa/Algiers", "Africa/Asmara", "Africa/Asmera", "Africa/Bamako", "Africa/Bangui", "Africa/Banjul", "Africa/Bissau", "Africa/Blantyre", "Africa/Brazzaville", "Africa/Bujumbura", "Africa/Cairo", "Africa/Casablanca", "Africa/Conakry", "Africa/Dakar", "Africa/Dar_es_Salaam", "Africa/Djibouti", "Africa/Douala", "Africa/El_Aaiun", "Africa/Freetown", "Africa/Gaborone", "Africa/Harare", "Africa/Johannesburg", "Africa/Juba", "Africa/Kampala", "Africa/Khartoum", "Africa/Kigali", "Africa/Libreville", "Africa/Lome", "Africa/Luanda", "Africa/Lusaka", "Africa/Malabo", "Africa/Maseru", "Africa/Mbabane", "Africa/Mogadishu", "Africa/Monrovia", "Africa/Nairobi", "Africa/Ndjamena", "Africa/Niamey", "Africa/Nouakchott", "Africa/Ouagadougou", "Africa/Porto-Novo", "Africa/Sao_Tome", "Africa/Timbuktu", "Africa/Tripoli", "Africa/Tunis", "Africa/Windhoek", "America/Anguilla", "America/Antigua", "America/Argentina/ComodRivadavia", "America/Aruba", "America/Asuncion", "America/Atka", "America/Barbados", "America/Belize", "America/Bogota", "America/Buenos_Aires", "America/Caracas", "America/Catamarca", "America/Cayenne", "America/Cayman", "America/Coral_Harbour", "America/Cordoba", "America/Costa_Rica", "America/Curacao", "America/Dominica", "America/El_Salvador", "America/Ensenada", "America/Fort_Wayne", "America/Godthab", "America/Grand_Turk", "America/Grenada", "America/Guadeloupe", "America/Guatemala", "America/Guyana", "America/Havana", "America/Indianapolis", "America/Jamaica", "America/Jujuy", "America/Knox_IN", "America/Kralendijk", "America/La_Paz", "America/Lima", "America/Louisville", "America/Lower_Princes", "America/Managua", "America/Marigot", "America/Martinique", "America/Mendoza", "America/Miquelon", "America/Montevideo", "America/Montreal", "America/Montserrat", "America/Nassau", "America/Nipigon", "America/Pangnirtung", "America/Paramaribo", "America/Port-au-Prince", "America/Port_of_Spain", "America/Porto_Acre", "America/Rainy_River", "America/Rosario", "America/Santa_Isabel", "America/Santo_Domingo", "America/Shiprock", "America/St_Barthelemy", "America/St_Kitts", "America/St_Lucia", "America/St_Thomas", "America/St_Vincent", "America/Tegucigalpa", "America/Thunder_Bay", "America/Tortola", "America/Virgin", "America/Yellowknife", "Antarctica/South_Pole", "Arctic/Longyearbyen", "Asia/Aden", "Asia/Amman", "Asia/Ashgabat", "Asia/Ashkhabad", "Asia/Baghdad", "Asia/Bahrain", "Asia/Baku", "Asia/Beirut", "Asia/Bishkek", "Asia/Brunei", "Asia/Calcutta", "Asia/Choibalsan", "Asia/Chongqing", "Asia/Chungking", "Asia/Colombo", "Asia/Dacca", "Asia/Damascus", "Asia/Dhaka", "Asia/Dili", "Asia/Dushanbe", "Asia/Harbin", "Asia/Hong_Kong", "Asia/Istanbul", "Asia/Jerusalem", "Asia/Kabul", "Asia/Karachi", "Asia/Kashgar", "Asia/Kathmandu", "Asia/Katmandu", "Asia/Kolkata", "Asia/Kuwait", "Asia/Macao", "Asia/Macau", "Asia/Manila", "Asia/Muscat", "Asia/Phnom_Penh", "Asia/Pyongyang", "Asia/Qatar", "Asia/Rangoon", "Asia/Saigon", "Asia/Seoul", "Asia/Taipei", "Asia/Tbilisi", "Asia/Tehran", "Asia/Tel_Aviv", "Asia/Thimbu", "Asia/Thimphu", "Asia/Ujung_Pandang", "Asia/Ulan_Bator", "Asia/Vientiane", "Asia/Yangon", "Asia/Yerevan", "Atlantic/Bermuda", "Atlantic/Cape_Verde", "Atlantic/Faeroe", "Atlantic/Faroe", "Atlantic/Jan_Mayen", "Atlantic/Reykjavik", "Atlantic/South_Georgia", "Atlantic/St_Helena", "Atlantic/Stanley", "Australia/ACT", "Australia/Canberra", "Australia/Currie", "Australia/LHI", "Australia/North", "Australia/NSW", "Australia/Queensland", "Australia/South", "Australia/Tasmania", "Australia/Victoria", "Australia/West", "Australia/Yancowinna", "Brazil/Acre", "Brazil/DeNoronha", "Brazil/East", "Brazil/West", "Canada/Atlantic", "Canada/Central", "Canada/Eastern", "Canada/Mountain", "Canada/Newfoundland", "Canada/Pacific", "Canada/Saskatchewan", "Canada/Yukon", "CET", "Chile/Continental", "Chile/EasterIsland", "CST6CDT", "Cuba", "EET", "Egypt", "Eire", "EST", "EST5EDT", "Etc/GMT", "Etc/GMT+0", "Etc/GMT+1", "Etc/GMT+10", "Etc/GMT+11", "Etc/GMT+12", "Etc/GMT+2", "Etc/GMT+3", "Etc/GMT+4", "Etc/GMT+5", "Etc/GMT+6", "Etc/GMT+7", "Etc/GMT+8", "Etc/GMT+9", "Etc/GMT-0", "Etc/GMT-1", "Etc/GMT-10", "Etc/GMT-11", "Etc/GMT-12", "Etc/GMT-13", "Etc/GMT-14", "Etc/GMT-2", "Etc/GMT-3", "Etc/GMT-4", "Etc/GMT-5", "Etc/GMT-6", "Etc/GMT-7", "Etc/GMT-8", "Etc/GMT-9", "Etc/GMT0", "Etc/Greenwich", "Etc/UCT", "Etc/Universal", "Etc/UTC", "Etc/Zulu", "Europe/Amsterdam", "Europe/Andorra", "Europe/Athens", "Europe/Belfast", "Europe/Belgrade", "Europe/Bratislava", "Europe/Brussels", "Europe/Bucharest", "Europe/Budapest", "Europe/Chisinau", "Europe/Copenhagen", "Europe/Dublin", "Europe/Gibraltar", "Europe/Guernsey", "Europe/Helsinki", "Europe/Isle_of_Man", "Europe/Istanbul", "Europe/Jersey", "Europe/Kiev", "Europe/Ljubljana", "Europe/London", "Europe/Luxembourg", "Europe/Malta", "Europe/Mariehamn", "Europe/Minsk", "Europe/Monaco", "Europe/Nicosia", "Europe/Oslo", "Europe/Paris", "Europe/Podgorica", "Europe/Prague", "Europe/Riga", "Europe/Rome", "Europe/San_Marino", "Europe/Sarajevo", "Europe/Skopje", "Europe/Sofia", "Europe/Stockholm", "Europe/Tallinn", "Europe/Tirane", "Europe/Tiraspol", "Europe/Uzhgorod", "Europe/Vaduz", "Europe/Vatican", "Europe/Vienna", "Europe/Vilnius", "Europe/Warsaw", "Europe/Zagreb", "Europe/Zaporozhye", "Factory", "GB", "GB-Eire", "GMT", "GMT+0", "GMT-0", "GMT0", "Greenwich", "Hongkong", "HST", "Iceland", "Indian/Antananarivo", "Indian/Chagos", "Indian/Christmas", "Indian/Cocos", "Indian/Comoro", "Indian/Kerguelen", "Indian/Mahe", "Indian/Mauritius", "Indian/Mayotte", "Indian/Reunion", "Iran", "Israel", "Jamaica", "Japan", "Kwajalein", "Libya", "MET", "Mexico/BajaNorte", "Mexico/BajaSur", "Mexico/General", "MST", "MST7MDT", "Navajo", "NZ", "NZ-CHAT", "Pacific/Apia", "Pacific/Efate", "Pacific/Enderbury", "Pacific/Fakaofo", "Pacific/Fiji", "Pacific/Funafuti", "Pacific/Guam", "Pacific/Johnston", "Pacific/Nauru", "Pacific/Niue", "Pacific/Norfolk", "Pacific/Noumea", "Pacific/Palau", "Pacific/Pitcairn", "Pacific/Ponape", "Pacific/Rarotonga", "Pacific/Saipan", "Pacific/Samoa", "Pacific/Tongatapu", "Pacific/Truk", "Pacific/Wallis", "Pacific/Yap", "Poland", "Portugal", "PRC", "PST8PDT", "ROC", "ROK", "Singapore", "Turkey", "UCT", "Universal", "US/Alaska", "US/Aleutian", "US/Arizona", "US/Central", "US/East-Indiana", "US/Eastern", "US/Hawaii", "US/Indiana-Starke", "US/Michigan", "US/Mountain", "US/Pacific", "US/Samoa", "UTC", "W-SU", "WET", "Zulu", "America/Rio_Branco", "America/Maceio", "America/Metlakatla", "America/Juneau", "America/Sitka", "America/Adak", "America/Yakutat", "America/Anchorage", "America/Nome", "America/Manaus", "America/Eirunepe", "Asia/Aqtobe", "America/Blanc-Sablon", "America/Puerto_Rico", "America/Goose_Bay", "America/Moncton", "America/Glace_Bay", "America/Halifax", "America/Noronha", "Asia/Atyrau", "Atlantic/Azores", "America/Bahia", "America/Bahia_Banderas", "America/Tijuana", "America/Mazatlan", "Asia/Hovd", "Asia/Shanghai", "Asia/Makassar", "Asia/Pontianak", "Pacific/Bougainville", "America/Fortaleza", "America/Sao_Paulo", "America/Argentina/Buenos_Aires", "Europe/Busingen", "Europe/Zurich", "America/Merida", "Atlantic/Canary", "Antarctica/Casey", "America/Argentina/Catamarca", "America/Indiana/Tell_City", "America/Indiana/Knox", "America/Menominee", "America/North_Dakota/Beulah", "America/North_Dakota/New_Salem", "America/North_Dakota/Center", "America/Rankin_Inlet", "America/Resolute", "America/Winnipeg", "America/Chicago", "Africa/Maputo", "America/Mexico_City", "Africa/Ceuta", "Pacific/Chatham", "America/Chihuahua", "America/Ojinaga", "America/Ciudad_Juarez", "Pacific/Chuuk", "America/Matamoros", "Europe/Simferopol", "Asia/Dubai", "America/Swift_Current", "America/Regina", "Antarctica/Davis", "Africa/Lubumbashi", "Africa/Kinshasa", "Antarctica/DumontDUrville", "America/Monterrey", "Pacific/Easter", "America/Indiana/Marengo", "America/Indiana/Vincennes", "America/Indiana/Indianapolis", "America/Indiana/Petersburg", "America/Indiana/Winamac", "America/Indiana/Vevay", "America/Kentucky/Louisville", "America/Kentucky/Monticello", "America/Detroit", "America/Iqaluit", "America/Toronto", "America/New_York", "America/Guayaquil", "America/Atikokan", "America/Panama", "Asia/Tokyo", "Pacific/Galapagos", "Pacific/Gambier", "Asia/Gaza", "Pacific/Tarawa", "Pacific/Honolulu", "Asia/Jakarta", "America/Argentina/Jujuy", "Indian/Maldives", "Pacific/Kosrae", "Pacific/Kwajalein", "America/Argentina/La_Rioja", "Pacific/Kiritimati", "Australia/Lord_Howe", "Antarctica/Macquarie", "Atlantic/Madeira", "Asia/Kuala_Lumpur", "Asia/Aqtau", "Pacific/Marquesas", "America/Cuiaba", "America/Campo_Grande", "Antarctica/Mawson", "America/Argentina/Mendoza", "Pacific/Pago_Pago", "Pacific/Midway", "America/Argentina/Cordoba", "America/Santiago", "Asia/Nicosia", "Europe/Berlin", "America/Nuuk", "Asia/Almaty", "Pacific/Majuro", "Asia/Ulaanbaatar", "Europe/Kyiv", "America/Edmonton", "America/Boise", "America/Inuvik", "America/Cambridge_Bay", "America/Denver", "Europe/Kaliningrad", "Europe/Kirov", "Europe/Moscow", "Europe/Volgograd", "Europe/Astrakhan", "Europe/Samara", "Europe/Saratov", "Europe/Ulyanovsk", "Asia/Yekaterinburg", "Asia/Omsk", "Asia/Barnaul", "Asia/Novokuznetsk", "Asia/Krasnoyarsk", "Asia/Novosibirsk", "Asia/Tomsk", "Asia/Irkutsk", "Asia/Yakutsk", "Asia/Khandyga", "Asia/Chita", "Asia/Vladivostok", "Asia/Ust-Nera", "Asia/Magadan", "Asia/Srednekolymsk", "Asia/Sakhalin", "Asia/Anadyr", "Asia/Kamchatka", "America/Phoenix", "America/Creston", "America/Dawson_Creek", "America/Fort_Nelson", "America/Whitehorse", "America/Dawson", "America/Danmarkshavn", "Asia/Jayapura", "Australia/Sydney", "Australia/Broken_Hill", "Pacific/Auckland", "Antarctica/McMurdo", "America/St_Johns", "Asia/Bangkok", "Asia/Famagusta", "Australia/Darwin", "America/Los_Angeles", "America/Vancouver", "Antarctica/Palmer", "Pacific/Port_Moresby", "America/Belem", "America/Santarem", "Asia/Singapore", "America/Recife", "Pacific/Kanton", "Pacific/Guadalcanal", "Pacific/Pohnpei", "Europe/Lisbon", "Asia/Qostanay", "Australia/Brisbane", "Australia/Lindeman", "America/Cancun", "Asia/Qyzylorda", "America/Punta_Arenas", "America/Porto_Velho", "America/Boa_Vista", "Antarctica/Rothera", "Asia/Kuching", "America/Argentina/Salta", "America/Argentina/San_Juan", "America/Argentina/San_Luis", "America/Argentina/Rio_Gallegos", "America/Scoresbysund", "Pacific/Tahiti", "America/Hermosillo", "Australia/Adelaide", "Asia/Ho_Chi_Minh", "Europe/Madrid", "Antarctica/Syowa", "Asia/Riyadh", "Australia/Hobart", "America/Thule", "America/Argentina/Ushuaia", "America/Araguaina", "Antarctica/Troll", "America/Argentina/Tucuman", "Asia/Tashkent", "Asia/Samarkand", "Australia/Melbourne", "Antarctica/Vostok", "Pacific/Wake", "Africa/Lagos", "Asia/Hebron", "Asia/Oral", "Australia/Eucla", "Australia/Perth", "Asia/Urumqi", ]; #[test] fn test_tzname_buffer_fits_all_iana_names() { let buf = tzname_buf(); let max_len = buf.len(); let mut failed_tz_names = vec![]; for &tz in KNOWN_TIMEZONE_NAMES { // Require max_len + 1 to account for an optional NUL terminator. if tz.len() >= max_len { failed_tz_names.push(tz); } } assert!( failed_tz_names.is_empty(), "One or more timezone names exceed the buffer length of {}. Max length of found timezone: {}\n{:?}", max_len, failed_tz_names.iter().map(|s| s.len()).max().unwrap(), failed_tz_names ); } #[test] fn test_tzname_buffer_correct_size() { assert_eq!( MAX_LEN, 64, "Buffer length changed unexpectedly, ensure consistency with documented limit." ); assert_eq!( tzname_buf().len(), MAX_LEN, "Buffer length changed unexpectedly, ensure consistency with documented limit." ); assert_eq!( size_of_val(&tzname_buf()), MAX_LEN, "Buffer length changed unexpectedly, ensure consistency with documented limit." ); } } iana-time-zone-0.1.63/src/lib.rs000064400000000000000000000066311046102023000144410ustar 00000000000000#![warn(clippy::all)] #![warn(clippy::cargo)] #![warn(clippy::undocumented_unsafe_blocks)] #![allow(unknown_lints)] #![warn(missing_copy_implementations)] #![warn(missing_debug_implementations)] #![warn(missing_docs)] #![warn(rust_2018_idioms)] #![warn(trivial_casts, trivial_numeric_casts)] #![warn(unused_qualifications)] #![warn(variant_size_differences)] //! get the IANA time zone for the current system //! //! This small utility crate provides the //! [`get_timezone()`](fn.get_timezone.html) function. //! //! ```rust //! // Get the current time zone as a string. //! let tz_str = iana_time_zone::get_timezone()?; //! println!("The current time zone is: {}", tz_str); //! # Ok::<(), iana_time_zone::GetTimezoneError>(()) //! ``` //! //! The resulting string can be parsed to a //! [`chrono-tz::Tz`](https://docs.rs/chrono-tz/latest/chrono_tz/enum.Tz.html) //! variant like this: //! ```rust //! let tz_str = iana_time_zone::get_timezone()?; //! let tz: chrono_tz::Tz = tz_str.parse()?; //! # Ok::<(), Box>(()) //! ``` #[allow(dead_code)] mod ffi_utils; #[cfg_attr( any(all(target_os = "linux", not(target_env = "ohos")), target_os = "hurd"), path = "tz_linux.rs" )] #[cfg_attr(all(target_os = "linux", target_env = "ohos"), path = "tz_ohos.rs")] #[cfg_attr(target_os = "windows", path = "tz_windows.rs")] #[cfg_attr(target_vendor = "apple", path = "tz_darwin.rs")] #[cfg_attr( all(target_arch = "wasm32", target_os = "unknown"), path = "tz_wasm32_unknown.rs" )] #[cfg_attr( any(target_os = "freebsd", target_os = "dragonfly"), path = "tz_freebsd.rs" )] #[cfg_attr( any(target_os = "netbsd", target_os = "openbsd"), path = "tz_netbsd.rs" )] #[cfg_attr( any(target_os = "illumos", target_os = "solaris"), path = "tz_illumos.rs" )] #[cfg_attr(target_os = "aix", path = "tz_aix.rs")] #[cfg_attr(target_os = "android", path = "tz_android.rs")] #[cfg_attr(target_os = "haiku", path = "tz_haiku.rs")] mod platform; /// Error types #[derive(Debug)] pub enum GetTimezoneError { /// Failed to parse FailedParsingString, /// Wrapped IO error IoError(std::io::Error), /// Platform-specific error from the operating system OsError, } impl std::error::Error for GetTimezoneError { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { match self { GetTimezoneError::FailedParsingString => None, GetTimezoneError::IoError(err) => Some(err), GetTimezoneError::OsError => None, } } } impl std::fmt::Display for GetTimezoneError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { f.write_str(match self { GetTimezoneError::FailedParsingString => "GetTimezoneError::FailedParsingString", GetTimezoneError::IoError(err) => return err.fmt(f), GetTimezoneError::OsError => "OsError", }) } } impl From for GetTimezoneError { fn from(orig: std::io::Error) -> Self { GetTimezoneError::IoError(orig) } } /// Get the current IANA time zone as a string. /// /// See the module-level documentation for a usage example and more details /// about this function. #[inline] pub fn get_timezone() -> Result { platform::get_timezone_inner() } #[cfg(test)] mod tests { use super::*; #[test] fn get_current() { println!("current: {}", get_timezone().unwrap()); } } iana-time-zone-0.1.63/src/platform.rs000064400000000000000000000005451046102023000155150ustar 00000000000000pub fn get_timezone_inner() -> Result { Err(crate::GetTimezoneError::OsError) } #[cfg(not(feature = "fallback"))] compile_error!( "iana-time-zone is currently implemented for Linux, Window, MacOS, FreeBSD, NetBSD, \ OpenBSD, Dragonfly, WebAssembly (browser), iOS, Illumos, Android, AIX, Solaris and Haiku.", ); iana-time-zone-0.1.63/src/tz_aix.rs000064400000000000000000000003371046102023000151660ustar 00000000000000use std::env; use std::fs::OpenOptions; use std::io::{BufRead, BufReader}; pub(crate) fn get_timezone_inner() -> Result { env::var("TZ").map_err(|_| crate::GetTimezoneError::OsError) } iana-time-zone-0.1.63/src/tz_android.rs000064400000000000000000000016501046102023000160240ustar 00000000000000use std::sync::Once; use android_system_properties::AndroidSystemProperties; use crate::ffi_utils::android_timezone_property_name; pub(crate) fn get_timezone_inner() -> Result { let key = android_timezone_property_name(); get_properties() .and_then(|properties| properties.get_from_cstr(key)) .ok_or(crate::GetTimezoneError::OsError) } fn get_properties() -> Option<&'static AndroidSystemProperties> { static INITIALIZED: Once = Once::new(); static mut PROPERTIES: Option = None; INITIALIZED.call_once(|| { let properties = AndroidSystemProperties::new(); // SAFETY: `INITIALIZED` is synchronizing. The variable is only assigned to once. unsafe { PROPERTIES = Some(properties) }; }); // SAFETY: `INITIALIZED` is synchronizing. The variable is only assigned to once. unsafe { PROPERTIES.as_ref() } } iana-time-zone-0.1.63/src/tz_darwin.rs000064400000000000000000000150671046102023000156770ustar 00000000000000use crate::ffi_utils::buffer::{tzname_buf, MAX_LEN}; pub(crate) fn get_timezone_inner() -> Result { get_timezone().ok_or(crate::GetTimezoneError::OsError) } #[inline] fn get_timezone() -> Option { let mut buf = tzname_buf(); // Get system time zone, and borrow its name. let tz = system_time_zone::SystemTimeZone::new()?; let name = tz.name()?; // If the name is encoded in UTF-8, copy it directly. let name = if let Some(name) = name.as_utf8() { name } else { // Otherwise convert the name to UTF-8. name.to_utf8(&mut buf)? }; if name.is_empty() || name.len() > MAX_LEN { // The name should not be empty, or excessively long. return None; } else { Some(name.to_owned()) } } mod system_time_zone { //! create a safe wrapper around `CFTimeZoneRef` use core_foundation_sys::base::{CFRelease, CFTypeRef}; use core_foundation_sys::timezone::{ CFTimeZoneCopySystem, CFTimeZoneGetName, CFTimeZoneRef, CFTimeZoneResetSystem, }; pub(crate) struct SystemTimeZone(CFTimeZoneRef); impl Drop for SystemTimeZone { fn drop(&mut self) { // SAFETY: `SystemTimeZone` is only ever created with a valid `CFTimeZoneRef`. unsafe { CFRelease(self.0 as CFTypeRef) }; } } impl SystemTimeZone { /// Creates a new `SystemTimeZone` by querying the current Darwin system /// timezone. /// /// This function implicitly calls `CFTimeZoneResetSystem` to invalidate /// the cached timezone and ensure we always retrieve the current system /// timezone. /// /// Due to CoreFoundation's internal caching mechanism, subsequent calls /// to `CFTimeZoneCopySystem` do not reflect system timezone changes /// made while the process is running. Thus, we explicitly call /// `CFTimeZoneResetSystem` first to invalidate the cached value and /// ensure we always retrieve the current system timezone. pub(crate) fn new() -> Option { // SAFETY: // - Both `CFTimeZoneResetSystem` and `CFTimeZoneCopySystem` are FFI // calls to macOS CoreFoundation. // - `CFTimeZoneResetSystem` safely invalidates the cached timezone // without any external invariants. // - The pointer returned by `CFTimeZoneCopySystem` is managed and // released properly within `Drop`. let v: CFTimeZoneRef = unsafe { // First, clear the potentially cached timezone. This call will // take the global lock on the timezone data. // // See // for context on why we reset the timezone here. CFTimeZoneResetSystem(); // Fetch the current value. This will likely allocate. This call // will again take the global lock on the timezone data. CFTimeZoneCopySystem() }; if v.is_null() { None } else { Some(SystemTimeZone(v)) } } /// Get the time zone name as a [`StringRef`]. /// /// The lifetime of the `StringRef` is bound to our lifetime. Mutable /// access is also prevented by taking a reference to `self`. /// /// [`StringRef`]: super::string_ref::StringRef pub(crate) fn name(&self) -> Option> { // SAFETY: `SystemTimeZone` is only ever created with a valid `CFTimeZoneRef`. let string = unsafe { CFTimeZoneGetName(self.0) }; if string.is_null() { None } else { // SAFETY: here we ensure that `string` is a valid pointer. Some(unsafe { super::string_ref::StringRef::new(string, self) }) } } } } mod string_ref { //! create safe wrapper around `CFStringRef` use core::convert::TryInto; use core_foundation_sys::base::{Boolean, CFRange}; use core_foundation_sys::string::{ kCFStringEncodingUTF8, CFStringGetBytes, CFStringGetCStringPtr, CFStringGetLength, CFStringRef, }; pub(crate) struct StringRef<'a, T> { string: CFStringRef, // We exclude mutable access to the parent by taking a reference to the // parent (rather than, for example, just using a marker to enforce the // parent's lifetime). _parent: &'a T, } impl<'a, T> StringRef<'a, T> { // SAFETY: `string` must be valid pointer pub(crate) unsafe fn new(string: CFStringRef, _parent: &'a T) -> Self { Self { string, _parent } } pub(crate) fn as_utf8(&self) -> Option<&'a str> { // SAFETY: `StringRef` is only ever created with a valid `CFStringRef`. let v = unsafe { CFStringGetCStringPtr(self.string, kCFStringEncodingUTF8) }; if !v.is_null() { // SAFETY: `CFStringGetCStringPtr()` returns NUL-terminated // strings and will return NULL if the internal representation // of the `CFString`` is not compatible with the requested // encoding. let v = unsafe { std::ffi::CStr::from_ptr(v) }; if let Ok(v) = v.to_str() { return Some(v); } } None } pub(crate) fn to_utf8<'b>(&self, buf: &'b mut [u8]) -> Option<&'b str> { // SAFETY: `StringRef` is only ever created with a valid `CFStringRef`. let length = unsafe { CFStringGetLength(self.string) }; let mut buf_bytes = 0; let range = CFRange { location: 0, length, }; // SAFETY: `StringRef` is only ever created with a valid `CFStringRef`. let converted_bytes = unsafe { CFStringGetBytes( self.string, range, kCFStringEncodingUTF8, b'\0', false as Boolean, buf.as_mut_ptr(), buf.len() as isize, &mut buf_bytes, ) }; if converted_bytes != length { return None; } let len = buf_bytes.try_into().ok()?; let s = buf.get(..len)?; std::str::from_utf8(s).ok() } } } iana-time-zone-0.1.63/src/tz_freebsd.rs000064400000000000000000000005341046102023000160160ustar 00000000000000pub(crate) fn get_timezone_inner() -> Result { // see https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/19 let mut contents = std::fs::read_to_string("/var/db/zoneinfo")?; // Trim to the correct length without allocating. contents.truncate(contents.trim_end().len()); Ok(contents) } iana-time-zone-0.1.63/src/tz_haiku.rs000064400000000000000000000002431046102023000155020ustar 00000000000000pub(crate) fn get_timezone_inner() -> Result { iana_time_zone_haiku::get_timezone().ok_or(crate::GetTimezoneError::OsError) } iana-time-zone-0.1.63/src/tz_illumos.rs000064400000000000000000000014371046102023000160730ustar 00000000000000use std::fs::OpenOptions; use std::io::{BufRead, BufReader}; pub(crate) fn get_timezone_inner() -> Result { // https://illumos.org/man/5/TIMEZONE // https://docs.oracle.com/cd/E23824_01/html/821-1473/uc-timezone-4.html let file = OpenOptions::new().read(true).open("/etc/default/init")?; let mut reader = BufReader::with_capacity(1536, file); let mut line = String::with_capacity(80); loop { line.clear(); let count = reader.read_line(&mut line)?; if count == 0 { return Err(crate::GetTimezoneError::FailedParsingString); } else if line.starts_with("TZ=") { line.truncate(line.trim_end().len()); line.replace_range(..3, ""); return Ok(line); } } } iana-time-zone-0.1.63/src/tz_linux.rs000064400000000000000000000151131046102023000155420ustar 00000000000000use std::fs::{read_link, read_to_string}; pub(crate) fn get_timezone_inner() -> Result { etc_localtime() .or_else(|_| etc_timezone()) .or_else(|_| openwrt::etc_config_system()) } fn etc_timezone() -> Result { // see https://stackoverflow.com/a/12523283 let mut contents = read_to_string("/etc/timezone")?; // Trim to the correct length without allocating. contents.truncate(contents.trim_end().len()); Ok(contents) } fn etc_localtime() -> Result { // Per : // “ The /etc/localtime file configures the system-wide timezone of the local system that is // used by applications for presentation to the user. It should be an absolute or relative // symbolic link pointing to /usr/share/zoneinfo/, followed by a timezone identifier such as // "Europe/Berlin" or "Etc/UTC". The resulting link should lead to the corresponding binary // tzfile(5) timezone data for the configured timezone. ” // Systemd does not canonicalize the link, but only checks if it is prefixed by // "/usr/share/zoneinfo/" or "../usr/share/zoneinfo/". So we do the same. // const PREFIXES: &[&str] = &[ "/usr/share/zoneinfo/", // absolute path "../usr/share/zoneinfo/", // relative path "/etc/zoneinfo/", // absolute path for NixOS "../etc/zoneinfo/", // relative path for NixOS ]; let mut s = read_link("/etc/localtime")? .into_os_string() .into_string() .map_err(|_| crate::GetTimezoneError::FailedParsingString)?; for &prefix in PREFIXES { if s.starts_with(prefix) { // Trim to the correct length without allocating. s.replace_range(..prefix.len(), ""); return Ok(s); } } Err(crate::GetTimezoneError::FailedParsingString) } mod openwrt { use std::io::BufRead; use std::{fs, io, iter}; pub(crate) fn etc_config_system() -> Result { let f = fs::OpenOptions::new() .read(true) .open("/etc/config/system")?; let mut f = io::BufReader::new(f); let mut in_system_section = false; let mut line = String::with_capacity(80); // prefer option "zonename" (IANA time zone) over option "timezone" (POSIX time zone) let mut timezone = None; loop { line.clear(); f.read_line(&mut line)?; if line.is_empty() { break; } let mut iter = IterWords(&line); let mut next = || iter.next().transpose(); if let Some(keyword) = next()? { if keyword == "config" { in_system_section = next()? == Some("system") && next()?.is_none(); } else if in_system_section && keyword == "option" { if let Some(key) = next()? { if key == "zonename" { if let (Some(zonename), None) = (next()?, next()?) { return Ok(zonename.to_owned()); } } else if key == "timezone" { if let (Some(value), None) = (next()?, next()?) { timezone = Some(value.to_owned()); } } } } } } timezone.ok_or(crate::GetTimezoneError::OsError) } #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] struct BrokenQuote; impl From for crate::GetTimezoneError { fn from(_: BrokenQuote) -> Self { crate::GetTimezoneError::FailedParsingString } } /// Iterated over all words in a OpenWRT config line. struct IterWords<'a>(&'a str); impl<'a> Iterator for IterWords<'a> { type Item = Result<&'a str, BrokenQuote>; fn next(&mut self) -> Option { match read_word(self.0) { Ok(Some((item, tail))) => { self.0 = tail; Some(Ok(item)) } Ok(None) => { self.0 = ""; None } Err(err) => { self.0 = ""; Some(Err(err)) } } } } impl iter::FusedIterator for IterWords<'_> {} /// Read the next word in a OpenWRT config line. Strip any surrounding quotation marks. /// /// Returns /// /// * a tuple `Some((word, remaining_line))` if found, /// * `None` if the line is exhausted, or /// * `Err(BrokenQuote)` if the line could not be parsed. #[allow(clippy::manual_strip)] // needs to be compatile to 1.36 fn read_word(s: &str) -> Result, BrokenQuote> { let s = s.trim_start(); if s.is_empty() || s.starts_with('#') { Ok(None) } else if s.starts_with('\'') { let mut iter = s[1..].splitn(2, '\''); match (iter.next(), iter.next()) { (Some(item), Some(tail)) => Ok(Some((item, tail))), _ => Err(BrokenQuote), } } else if s.starts_with('"') { let mut iter = s[1..].splitn(2, '"'); match (iter.next(), iter.next()) { (Some(item), Some(tail)) => Ok(Some((item, tail))), _ => Err(BrokenQuote), } } else { let mut iter = s.splitn(2, |c: char| c.is_whitespace()); match (iter.next(), iter.next()) { (Some(item), Some(tail)) => Ok(Some((item, tail))), _ => Ok(Some((s, ""))), } } } #[cfg(test)] #[test] fn test_read_word() { assert_eq!( read_word(" option timezone 'CST-8'\n").unwrap(), Some(("option", "timezone 'CST-8'\n")), ); assert_eq!( read_word("timezone 'CST-8'\n").unwrap(), Some(("timezone", "'CST-8'\n")), ); assert_eq!(read_word("'CST-8'\n").unwrap(), Some(("CST-8", "\n"))); assert_eq!(read_word("\n").unwrap(), None); assert_eq!( read_word(r#""time 'Zone'""#).unwrap(), Some(("time 'Zone'", "")), ); assert_eq!(read_word("'CST-8").unwrap_err(), BrokenQuote); } } iana-time-zone-0.1.63/src/tz_netbsd.rs000064400000000000000000000015571046102023000156710ustar 00000000000000use std::fs::read_link; pub(crate) fn get_timezone_inner() -> Result { // see https://www.cyberciti.biz/faq/openbsd-time-zone-howto/ // This is a backport of the Linux implementation. // NetBSDs is less than thorough how the softlink should be set up. const PREFIXES: &[&str] = &[ "/usr/share/zoneinfo/", // absolute path "../usr/share/zoneinfo/", // relative path ]; let mut s = read_link("/etc/localtime")? .into_os_string() .into_string() .map_err(|_| crate::GetTimezoneError::FailedParsingString)?; for &prefix in PREFIXES { if s.starts_with(prefix) { // Trim to the correct length without allocating. s.replace_range(..prefix.len(), ""); return Ok(s); } } Err(crate::GetTimezoneError::FailedParsingString) } iana-time-zone-0.1.63/src/tz_ohos.rs000064400000000000000000000035231046102023000153550ustar 00000000000000//! OpenHarmony doesn't have `/etc/localtime`, we have to use it's "Time Service" to get the timezone information: //! //! - [API Reference](https://gitee.com/openharmony/docs/blob/43726785b4033887cd1a838aaaca5e255897a71e/en/application-dev/reference/apis-basic-services-kit/_time_service.md#oh_timeservice_gettimezone) use crate::ffi_utils::buffer::{tzname_buf, MAX_LEN}; use crate::GetTimezoneError; use std::ffi::{c_char, CStr}; #[derive(Debug, Copy, Clone, Eq, PartialEq)] #[repr(C)] #[allow(non_camel_case_types)] #[allow(dead_code)] enum TimeService_ErrCode { TIMESERVICE_ERR_OK = 0, TIMESERVICE_ERR_INTERNAL_ERROR = 13000001, TIMESERVICE_ERR_INVALID_PARAMETER = 13000002, } #[link(name = "time_service_ndk", kind = "dylib")] extern "C" { fn OH_TimeService_GetTimeZone(timeZone: *mut c_char, len: u32) -> TimeService_ErrCode; } /// TODO: Change this `CStr::from_bytes_until_nul` once MSRV was bumped above 1.69.0 fn from_bytes_until_nul(bytes: &[u8]) -> Option<&CStr> { let nul_pos = bytes.iter().position(|&b| b == 0)?; // SAFETY: // 1. nul_pos + 1 <= bytes.len() // 2. We know there is a nul byte at nul_pos, so this slice (ending at the nul byte) is a well-formed C string. Some(unsafe { CStr::from_bytes_with_nul_unchecked(&bytes[..=nul_pos]) }) } pub(crate) fn get_timezone_inner() -> Result { let mut time_zone = tzname_buf(); // SAFETY: // `time_zone` is a valid buffer with a length of 40 bytes. let ret = unsafe { OH_TimeService_GetTimeZone(time_zone.as_mut_ptr().cast::(), MAX_LEN as u32 - 1) }; if ret != TimeService_ErrCode::TIMESERVICE_ERR_OK { return Err(GetTimezoneError::OsError); } from_bytes_until_nul(&time_zone) .and_then(|x| x.to_str().ok()) .map(|x| x.to_owned()) .ok_or(GetTimezoneError::OsError) } iana-time-zone-0.1.63/src/tz_wasm32_unknown.rs000064400000000000000000000011321046102023000172720ustar 00000000000000use js_sys::{Array, Intl, Object, Reflect}; use wasm_bindgen::JsValue; pub(crate) fn get_timezone_inner() -> Result { let intl = Intl::DateTimeFormat::new(&Array::new(), &Object::new()).resolved_options(); Reflect::get(&intl, &JsValue::from_str("timeZone")) .ok() .and_then(|tz| tz.as_string()) .ok_or(crate::GetTimezoneError::OsError) } #[cfg(test)] mod tests { use wasm_bindgen_test::*; #[wasm_bindgen_test] fn pass() { let tz = super::get_timezone_inner().unwrap(); console_log!("tz={:?}", tz); } } iana-time-zone-0.1.63/src/tz_windows.rs000064400000000000000000000011131046102023000160700ustar 00000000000000#[path = "windows_bindings.rs"] #[allow(missing_debug_implementations, clippy::undocumented_unsafe_blocks)] mod windows_bindings; use windows_bindings::Windows::Globalization::Calendar; impl From for crate::GetTimezoneError { fn from(orig: windows_core::Error) -> Self { crate::GetTimezoneError::IoError(std::io::Error::new(std::io::ErrorKind::Other, orig)) } } pub(crate) fn get_timezone_inner() -> Result { let cal = Calendar::new()?; let tz_hstring = cal.GetTimeZone()?; Ok(tz_hstring.to_string()) } iana-time-zone-0.1.63/src/windows_bindings.rs000064400000000000000000002050551046102023000172430ustar 00000000000000// Bindings generated by `windows-bindgen` 0.59.0 #![allow( non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all )] pub mod Windows { pub mod Globalization { #[repr(transparent)] #[derive(Clone, Debug, Eq, PartialEq)] pub struct Calendar(windows_core::IUnknown); windows_core::imp::interface_hierarchy!( Calendar, windows_core::IUnknown, windows_core::IInspectable ); impl Calendar { pub fn new() -> windows_core::Result { Self::IActivationFactory(|f| f.ActivateInstance::()) } fn IActivationFactory< R, F: FnOnce(&windows_core::imp::IGenericFactory) -> windows_core::Result, >( callback: F, ) -> windows_core::Result { static SHARED: windows_core::imp::FactoryCache< Calendar, windows_core::imp::IGenericFactory, > = windows_core::imp::FactoryCache::new(); SHARED.call(callback) } pub fn Clone(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Clone)( windows_core::Interface::as_raw(this), &mut result__, ) .and_then(|| windows_core::Type::from_abi(result__)) } } pub fn SetToMin(&self) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetToMin)( windows_core::Interface::as_raw(this), ) .ok() } } pub fn SetToMax(&self) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetToMax)( windows_core::Interface::as_raw(this), ) .ok() } } pub fn NumeralSystem(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).NumeralSystem)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn SetNumeralSystem( &self, value: &windows_core::HSTRING, ) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetNumeralSystem)( windows_core::Interface::as_raw(this), core::mem::transmute_copy(value), ) .ok() } } pub fn GetCalendarSystem(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).GetCalendarSystem)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn ChangeCalendarSystem( &self, value: &windows_core::HSTRING, ) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).ChangeCalendarSystem)( windows_core::Interface::as_raw(this), core::mem::transmute_copy(value), ) .ok() } } pub fn GetClock(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).GetClock)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn ChangeClock(&self, value: &windows_core::HSTRING) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).ChangeClock)( windows_core::Interface::as_raw(this), core::mem::transmute_copy(value), ) .ok() } } pub fn SetToNow(&self) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetToNow)( windows_core::Interface::as_raw(this), ) .ok() } } pub fn FirstEra(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).FirstEra)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn LastEra(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).LastEra)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn NumberOfEras(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).NumberOfEras)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Era(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Era)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn SetEra(&self, value: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetEra)( windows_core::Interface::as_raw(this), value, ) .ok() } } pub fn AddEras(&self, eras: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).AddEras)( windows_core::Interface::as_raw(this), eras, ) .ok() } } pub fn EraAsFullString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).EraAsFullString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn EraAsString( &self, ideallength: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).EraAsString)( windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn FirstYearInThisEra(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).FirstYearInThisEra)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn LastYearInThisEra(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).LastYearInThisEra)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn NumberOfYearsInThisEra(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).NumberOfYearsInThisEra)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Year(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Year)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn SetYear(&self, value: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetYear)( windows_core::Interface::as_raw(this), value, ) .ok() } } pub fn AddYears(&self, years: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).AddYears)( windows_core::Interface::as_raw(this), years, ) .ok() } } pub fn YearAsString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).YearAsString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn YearAsTruncatedString( &self, remainingdigits: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).YearAsTruncatedString)( windows_core::Interface::as_raw(this), remainingdigits, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn YearAsPaddedString( &self, mindigits: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).YearAsPaddedString)( windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn FirstMonthInThisYear(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).FirstMonthInThisYear)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn LastMonthInThisYear(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).LastMonthInThisYear)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn NumberOfMonthsInThisYear(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).NumberOfMonthsInThisYear)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Month(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Month)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn SetMonth(&self, value: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetMonth)( windows_core::Interface::as_raw(this), value, ) .ok() } } pub fn AddMonths(&self, months: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).AddMonths)( windows_core::Interface::as_raw(this), months, ) .ok() } } pub fn MonthAsFullString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).MonthAsFullString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn MonthAsString( &self, ideallength: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).MonthAsString)( windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn MonthAsFullSoloString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).MonthAsFullSoloString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn MonthAsSoloString( &self, ideallength: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).MonthAsSoloString)( windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn MonthAsNumericString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).MonthAsNumericString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn MonthAsPaddedNumericString( &self, mindigits: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).MonthAsPaddedNumericString)( windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn AddWeeks(&self, weeks: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).AddWeeks)( windows_core::Interface::as_raw(this), weeks, ) .ok() } } pub fn FirstDayInThisMonth(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).FirstDayInThisMonth)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn LastDayInThisMonth(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).LastDayInThisMonth)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn NumberOfDaysInThisMonth(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).NumberOfDaysInThisMonth)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Day(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Day)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn SetDay(&self, value: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetDay)( windows_core::Interface::as_raw(this), value, ) .ok() } } pub fn AddDays(&self, days: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).AddDays)( windows_core::Interface::as_raw(this), days, ) .ok() } } pub fn DayAsString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).DayAsString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn DayAsPaddedString( &self, mindigits: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).DayAsPaddedString)( windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn DayOfWeekAsFullString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).DayOfWeekAsFullString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn DayOfWeekAsString( &self, ideallength: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).DayOfWeekAsString)( windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn DayOfWeekAsFullSoloString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).DayOfWeekAsFullSoloString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn DayOfWeekAsSoloString( &self, ideallength: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).DayOfWeekAsSoloString)( windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn FirstPeriodInThisDay(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).FirstPeriodInThisDay)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn LastPeriodInThisDay(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).LastPeriodInThisDay)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn NumberOfPeriodsInThisDay(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).NumberOfPeriodsInThisDay)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Period(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Period)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn SetPeriod(&self, value: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetPeriod)( windows_core::Interface::as_raw(this), value, ) .ok() } } pub fn AddPeriods(&self, periods: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).AddPeriods)( windows_core::Interface::as_raw(this), periods, ) .ok() } } pub fn PeriodAsFullString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).PeriodAsFullString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn PeriodAsString( &self, ideallength: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).PeriodAsString)( windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn FirstHourInThisPeriod(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).FirstHourInThisPeriod)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn LastHourInThisPeriod(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).LastHourInThisPeriod)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn NumberOfHoursInThisPeriod(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).NumberOfHoursInThisPeriod)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn Hour(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Hour)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn SetHour(&self, value: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetHour)( windows_core::Interface::as_raw(this), value, ) .ok() } } pub fn AddHours(&self, hours: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).AddHours)( windows_core::Interface::as_raw(this), hours, ) .ok() } } pub fn HourAsString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).HourAsString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn HourAsPaddedString( &self, mindigits: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).HourAsPaddedString)( windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn Minute(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Minute)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn SetMinute(&self, value: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetMinute)( windows_core::Interface::as_raw(this), value, ) .ok() } } pub fn AddMinutes(&self, minutes: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).AddMinutes)( windows_core::Interface::as_raw(this), minutes, ) .ok() } } pub fn MinuteAsString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).MinuteAsString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn MinuteAsPaddedString( &self, mindigits: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).MinuteAsPaddedString)( windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn Second(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Second)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn SetSecond(&self, value: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetSecond)( windows_core::Interface::as_raw(this), value, ) .ok() } } pub fn AddSeconds(&self, seconds: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).AddSeconds)( windows_core::Interface::as_raw(this), seconds, ) .ok() } } pub fn SecondAsString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).SecondAsString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn SecondAsPaddedString( &self, mindigits: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).SecondAsPaddedString)( windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn Nanosecond(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Nanosecond)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn SetNanosecond(&self, value: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).SetNanosecond)( windows_core::Interface::as_raw(this), value, ) .ok() } } pub fn AddNanoseconds(&self, nanoseconds: i32) -> windows_core::Result<()> { let this = self; unsafe { (windows_core::Interface::vtable(this).AddNanoseconds)( windows_core::Interface::as_raw(this), nanoseconds, ) .ok() } } pub fn NanosecondAsString(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).NanosecondAsString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn NanosecondAsPaddedString( &self, mindigits: i32, ) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).NanosecondAsPaddedString)( windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn Compare(&self, other: P0) -> windows_core::Result where P0: windows_core::Param, { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).Compare)( windows_core::Interface::as_raw(this), other.param().abi(), &mut result__, ) .map(|| result__) } } pub fn CopyTo(&self, other: P0) -> windows_core::Result<()> where P0: windows_core::Param, { let this = self; unsafe { (windows_core::Interface::vtable(this).CopyTo)( windows_core::Interface::as_raw(this), other.param().abi(), ) .ok() } } pub fn FirstMinuteInThisHour(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).FirstMinuteInThisHour)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn LastMinuteInThisHour(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).LastMinuteInThisHour)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn NumberOfMinutesInThisHour(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).NumberOfMinutesInThisHour)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn FirstSecondInThisMinute(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).FirstSecondInThisMinute)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn LastSecondInThisMinute(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).LastSecondInThisMinute)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn NumberOfSecondsInThisMinute(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).NumberOfSecondsInThisMinute)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn ResolvedLanguage(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).ResolvedLanguage)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn IsDaylightSavingTime(&self) -> windows_core::Result { let this = self; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).IsDaylightSavingTime)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| result__) } } pub fn GetTimeZone(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).GetTimeZone)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn ChangeTimeZone( &self, timezoneid: &windows_core::HSTRING, ) -> windows_core::Result<()> { let this = &windows_core::Interface::cast::(self)?; unsafe { (windows_core::Interface::vtable(this).ChangeTimeZone)( windows_core::Interface::as_raw(this), core::mem::transmute_copy(timezoneid), ) .ok() } } pub fn TimeZoneAsFullString(&self) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).TimeZoneAsFullString)( windows_core::Interface::as_raw(this), &mut result__, ) .map(|| core::mem::transmute(result__)) } } pub fn TimeZoneAsString( &self, ideallength: i32, ) -> windows_core::Result { let this = &windows_core::Interface::cast::(self)?; unsafe { let mut result__ = core::mem::zeroed(); (windows_core::Interface::vtable(this).TimeZoneAsString)( windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .map(|| core::mem::transmute(result__)) } } fn ICalendarFactory windows_core::Result>( callback: F, ) -> windows_core::Result { static SHARED: windows_core::imp::FactoryCache = windows_core::imp::FactoryCache::new(); SHARED.call(callback) } fn ICalendarFactory2 windows_core::Result>( callback: F, ) -> windows_core::Result { static SHARED: windows_core::imp::FactoryCache = windows_core::imp::FactoryCache::new(); SHARED.call(callback) } } impl windows_core::RuntimeType for Calendar { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_class::(); } unsafe impl windows_core::Interface for Calendar { type Vtable = ::Vtable; const IID: windows_core::GUID = ::IID; } impl windows_core::RuntimeName for Calendar { const NAME: &'static str = "Windows.Globalization.Calendar"; } unsafe impl Send for Calendar {} unsafe impl Sync for Calendar {} windows_core::imp::define_interface!( ICalendar, ICalendar_Vtbl, 0xca30221d_86d9_40fb_a26b_d44eb7cf08ea ); impl windows_core::RuntimeType for ICalendar { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_interface::(); } #[repr(C)] pub struct ICalendar_Vtbl { pub base__: windows_core::IInspectable_Vtbl, pub Clone: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub SetToMin: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT, pub SetToMax: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT, get_Languages: usize, pub NumeralSystem: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub SetNumeralSystem: unsafe extern "system" fn( *mut core::ffi::c_void, *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub GetCalendarSystem: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub ChangeCalendarSystem: unsafe extern "system" fn( *mut core::ffi::c_void, *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub GetClock: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub ChangeClock: unsafe extern "system" fn( *mut core::ffi::c_void, *mut core::ffi::c_void, ) -> windows_core::HRESULT, GetDateTime: usize, SetDateTime: usize, pub SetToNow: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT, pub FirstEra: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub LastEra: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub NumberOfEras: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub Era: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub SetEra: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub AddEras: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub EraAsFullString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub EraAsString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub FirstYearInThisEra: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub LastYearInThisEra: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub NumberOfYearsInThisEra: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub Year: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub SetYear: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub AddYears: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub YearAsString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub YearAsTruncatedString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub YearAsPaddedString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub FirstMonthInThisYear: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub LastMonthInThisYear: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub NumberOfMonthsInThisYear: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub Month: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub SetMonth: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub AddMonths: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub MonthAsFullString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub MonthAsString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub MonthAsFullSoloString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub MonthAsSoloString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub MonthAsNumericString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub MonthAsPaddedNumericString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub AddWeeks: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub FirstDayInThisMonth: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub LastDayInThisMonth: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub NumberOfDaysInThisMonth: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub Day: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub SetDay: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub AddDays: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub DayAsString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub DayAsPaddedString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, get_DayOfWeek: usize, pub DayOfWeekAsFullString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub DayOfWeekAsString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub DayOfWeekAsFullSoloString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub DayOfWeekAsSoloString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub FirstPeriodInThisDay: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub LastPeriodInThisDay: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub NumberOfPeriodsInThisDay: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub Period: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub SetPeriod: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub AddPeriods: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub PeriodAsFullString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub PeriodAsString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub FirstHourInThisPeriod: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub LastHourInThisPeriod: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub NumberOfHoursInThisPeriod: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub Hour: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub SetHour: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub AddHours: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub HourAsString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub HourAsPaddedString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub Minute: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub SetMinute: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub AddMinutes: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub MinuteAsString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub MinuteAsPaddedString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub Second: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub SetSecond: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub AddSeconds: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub SecondAsString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub SecondAsPaddedString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub Nanosecond: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub SetNanosecond: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub AddNanoseconds: unsafe extern "system" fn(*mut core::ffi::c_void, i32) -> windows_core::HRESULT, pub NanosecondAsString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub NanosecondAsPaddedString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub Compare: unsafe extern "system" fn( *mut core::ffi::c_void, *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, CompareDateTime: usize, pub CopyTo: unsafe extern "system" fn( *mut core::ffi::c_void, *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub FirstMinuteInThisHour: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub LastMinuteInThisHour: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub NumberOfMinutesInThisHour: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub FirstSecondInThisMinute: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub LastSecondInThisMinute: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub NumberOfSecondsInThisMinute: unsafe extern "system" fn( *mut core::ffi::c_void, *mut i32, ) -> windows_core::HRESULT, pub ResolvedLanguage: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub IsDaylightSavingTime: unsafe extern "system" fn( *mut core::ffi::c_void, *mut bool, ) -> windows_core::HRESULT, } windows_core::imp::define_interface!( ICalendarFactory, ICalendarFactory_Vtbl, 0x83f58412_e56b_4c75_a66e_0f63d57758a6 ); impl windows_core::RuntimeType for ICalendarFactory { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_interface::(); } #[repr(C)] pub struct ICalendarFactory_Vtbl { pub base__: windows_core::IInspectable_Vtbl, CreateCalendarDefaultCalendarAndClock: usize, CreateCalendar: usize, } windows_core::imp::define_interface!( ICalendarFactory2, ICalendarFactory2_Vtbl, 0xb44b378c_ca7e_4590_9e72_ea2bec1a5115 ); impl windows_core::RuntimeType for ICalendarFactory2 { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_interface::(); } #[repr(C)] pub struct ICalendarFactory2_Vtbl { pub base__: windows_core::IInspectable_Vtbl, CreateCalendarWithTimeZone: usize, } windows_core::imp::define_interface!( ITimeZoneOnCalendar, ITimeZoneOnCalendar_Vtbl, 0xbb3c25e5_46cf_4317_a3f5_02621ad54478 ); impl windows_core::RuntimeType for ITimeZoneOnCalendar { const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_interface::(); } #[repr(C)] pub struct ITimeZoneOnCalendar_Vtbl { pub base__: windows_core::IInspectable_Vtbl, pub GetTimeZone: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub ChangeTimeZone: unsafe extern "system" fn( *mut core::ffi::c_void, *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub TimeZoneAsFullString: unsafe extern "system" fn( *mut core::ffi::c_void, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, pub TimeZoneAsString: unsafe extern "system" fn( *mut core::ffi::c_void, i32, *mut *mut core::ffi::c_void, ) -> windows_core::HRESULT, } } }