iana-time-zone-0.1.60/.cargo_vcs_info.json0000644000000001360000000000100137350ustar { "git": { "sha1": "bf8375336a9cc5fbdb0c40f92bdd0b1b13a8a879" }, "path_in_vcs": "" }iana-time-zone-0.1.60/.clang-format000064400000000000000000000001711046102023000150770ustar 00000000000000--- BasedOnStyle: Google IndentWidth: 4 ColumnLimit: 100 --- Language: Cpp SortIncludes: false TabWidth: 4 UseTab: Never iana-time-zone-0.1.60/.github/dependabot.yml000064400000000000000000000003201046102023000167100ustar 00000000000000version: 2 updates: - package-ecosystem: cargo directory: "/" schedule: interval: daily time: "04:00" open-pull-requests-limit: 10 ignore: - dependency-name: winrt versions: - 0.8.0 iana-time-zone-0.1.60/.github/workflows/rust.yml000064400000000000000000000263501046102023000176500ustar 00000000000000name: build on: push: branches: - main pull_request: branches: [ '**' ] schedule: # At 23:25 on Thursday. - cron: "25 23 * * 4" jobs: test: strategy: fail-fast: false matrix: runs-on: [ubuntu-20.04, windows-2022, macos-12] toolchain: - "1.48" - stable - nightly versions: - "" - "-Zminimal-versions" exclude: # `windows-core >= 0.51` uses `edition = "2021"`, but users of the library can can use # `windows-core == 0.50` to be rust 1.48 compatible. - runs-on: windows-2022 toolchain: "1.48" versions: "" runs-on: ${{ matrix.runs-on }} steps: - name: Checkout uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 if: matrix.runs-on == 'macos-12' && matrix.toolchain == '1.48' with: xcode-version: "13.4.1" - 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.48" runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - 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: versions: - "" - "-Zminimal-versions" toolchain: - stable - nightly runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - 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@v3 with: node-version: 14 - name: Install "wasm-pack" uses: taiki-e/install-action@v2 with: tool: wasm-pack - name: Update lockfile run: cargo generate-lockfile ${{ matrix.versions }} env: RUSTC_BOOTSTRAP: 1 - run: wasm-pack test --node build-cross: strategy: fail-fast: false matrix: target: - x86_64-unknown-freebsd - x86_64-unknown-illumos - x86_64-unknown-netbsd - sparcv9-sun-solaris versions: - "" - "-Zminimal-versions" runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - 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@v3 - 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.48" - stable target: - x86_64-apple-ios versions: - "" - "-Zminimal-versions" exclude: # Support for this target was added quite recently. - target: aarch64-apple-ios-sim - toolchain: "1.48" runs-on: macos-12 steps: - name: Checkout uses: actions/checkout@v3 - 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.48" - stable - nightly versions: - "" - "-Zminimal-versions" runs-on: ubuntu-latest env: RUSTFLAGS: -D warnings RUST_BACKTRACE: 1 steps: - name: Checkout uses: actions/checkout@v3 - 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 - run: cargo clippy --all-targets no-docker-image-check-only: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - 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@v3 - 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@v3 - name: Audit uses: rustsec/audit-check@v1.4.1 with: token: ${{ secrets.GITHUB_TOKEN }} fallback: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - 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@v3 - name: Setup Node.js runtime uses: actions/setup-node@v3 with: node-version: 16 - 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-20.04, windows-2022, macos-12] toolchain: - stable versions: - "" runs-on: ${{ matrix.runs-on }} env: RUSTFLAGS: -D warnings RUST_BACKTRACE: 1 steps: - name: Checkout uses: actions/checkout@v3 - 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@v3 - 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 working-directory: haiku check-all-versions: runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v3 - 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 1.36.. --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@v3 - 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) iana-time-zone-0.1.60/.gitignore000064400000000000000000000000221046102023000145070ustar 00000000000000target Cargo.lock iana-time-zone-0.1.60/CHANGELOG.md000064400000000000000000000342471046102023000143500ustar 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.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.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.60/Cargo.lock0000644000000201140000000000100117060ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[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 = "bumpalo" version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "cc" version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "libc", ] [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "console_error_panic_hook" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" dependencies = [ "cfg-if", "wasm-bindgen", ] [[package]] name = "core-foundation-sys" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "iana-time-zone" version = "0.1.60" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "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.67" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "log" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "once_cell" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "proc-macro2" version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] [[package]] name = "scoped-tls" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] name = "syn" version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "wasm-bindgen" version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" dependencies = [ "cfg-if", "js-sys", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "wasm-bindgen-test" version = "0.3.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "139bd73305d50e1c1c4333210c0db43d989395b64a237bd35c10ef3832a7f70c" dependencies = [ "console_error_panic_hook", "js-sys", "scoped-tls", "wasm-bindgen", "wasm-bindgen-futures", "wasm-bindgen-test-macro", ] [[package]] name = "wasm-bindgen-test-macro" version = "0.3.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70072aebfe5da66d2716002c729a14e4aec4da0e23cc2ea66323dac541c93928" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "web-sys" version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] name = "windows-core" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" [[package]] name = "windows_aarch64_msvc" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" [[package]] name = "windows_i686_gnu" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" [[package]] name = "windows_x86_64_gnu" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" iana-time-zone-0.1.60/Cargo.toml0000644000000031660000000000100117410ustar # 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 = "2018" name = "iana-time-zone" version = "0.1.60" authors = [ "Andrew Straw ", "René Kijewski ", "Ryan Lopopolo ", ] 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 = [] [target."cfg(any(target_os = \"macos\", target_os = \"ios\"))".dependencies.core-foundation-sys] version = "0.8.3" [target."cfg(target_arch = \"wasm32\")".dependencies.js-sys] version = "0.3.50" [target."cfg(target_arch = \"wasm32\")".dependencies.wasm-bindgen] version = "0.2.70" [target."cfg(target_arch = \"wasm32\")".dev-dependencies.wasm-bindgen-test] version = "0.3" [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.50, <=0.52" iana-time-zone-0.1.60/Cargo.toml.orig000064400000000000000000000024031046102023000154130ustar 00000000000000[package] name = "iana-time-zone" description = "get the IANA time zone for the current system" version = "0.1.60" 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 = "2018" [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(any(target_os = "macos", target_os = "ios"))'.dependencies] core-foundation-sys = "0.8.3" [target.'cfg(target_os = "windows")'.dependencies] windows-core = { version = ">=0.50, <=0.52" } [target.'cfg(target_arch = "wasm32")'.dependencies] js-sys = "0.3.50" wasm-bindgen = "0.2.70" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = "0.3" [target.'cfg(target_os = "haiku")'.dependencies] iana-time-zone-haiku = { version = "0.1.1", path = "haiku" } [workspace] members = [".", "haiku"] default-members = ["."] iana-time-zone-0.1.60/LICENSE-APACHE000064400000000000000000000251201046102023000144510ustar 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.60/LICENSE-MIT000064400000000000000000000020431046102023000141600ustar 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.60/README.md000064400000000000000000000034651046102023000140140ustar 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 the [tz database](https://en.wikipedia.org/wiki/Tz_database), tzdata, the zoneinfo database, and the Olson 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.48 for [Tier 1](https://doc.rust-lang.org/1.63.0/rustc/platform-support.html) platforms. 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.60/bindings.txt000064400000000000000000000007711046102023000150700ustar 00000000000000--out src/Windows.rs --filter Windows.Globalization.Calendar # Dependencies of the above Windows.Foundation.Collections.IIterable Windows.Foundation.Collections.IIterator Windows.Foundation.Collections.IVectorView Windows.Foundation.DateTime Windows.Foundation.TimeSpan Windows.Globalization.DayOfWeek Windows.Globalization.ICalendar Windows.Globalization.ICalendarFactory Windows.Globalization.ICalendarFactory2 Windows.Globalization.ITimeZoneOnCalendar iana-time-zone-0.1.60/examples/get_timezone.rs000064400000000000000000000002251046102023000174010ustar 00000000000000use iana_time_zone::{get_timezone, GetTimezoneError}; fn main() -> Result<(), GetTimezoneError> { println!("{}", get_timezone()?); Ok(()) } iana-time-zone-0.1.60/examples/stress-test.rs000064400000000000000000000012041046102023000172060ustar 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.60/src/Windows.rs000064400000000000000000002725031046102023000153250ustar 00000000000000// Bindings generated by `windows-bindgen` 0.51.1 #![allow( non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all )] pub mod Foundation { pub mod Collections { #[repr(transparent)] pub struct IIterable(::windows_core::IUnknown, ::core::marker::PhantomData) where T: ::windows_core::RuntimeType + 'static; impl IIterable { pub fn First(&self) -> ::windows_core::Result> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).First)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } } impl ::windows_core::CanInto<::windows_core::IUnknown> for IIterable { } impl ::windows_core::CanInto<::windows_core::IInspectable> for IIterable { } impl ::core::cmp::PartialEq for IIterable { fn eq(&self, other: &Self) -> bool { self.0 == other.0 } } impl ::core::cmp::Eq for IIterable {} impl ::core::fmt::Debug for IIterable { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_tuple("IIterable").field(&self.0).finish() } } impl ::windows_core::RuntimeType for IIterable { const SIGNATURE: ::windows_core::imp::ConstBuffer = { ::windows_core::imp::ConstBuffer::new() .push_slice(b"pinterface(") .push_slice(b"{faa585ea-6214-4217-afda-7f46de5869b3}") .push_slice(b";") .push_other(::SIGNATURE) .push_slice(b")") }; } impl ::core::iter::IntoIterator for IIterable { type Item = T; type IntoIter = IIterator; fn into_iter(self) -> Self::IntoIter { ::core::iter::IntoIterator::into_iter(&self) } } impl ::core::iter::IntoIterator for &IIterable { type Item = T; type IntoIter = IIterator; fn into_iter(self) -> Self::IntoIter { self.First().unwrap() } } unsafe impl ::windows_core::Interface for IIterable { type Vtable = IIterable_Vtbl; } impl ::core::clone::Clone for IIterable { fn clone(&self) -> Self { Self(self.0.clone(), ::core::marker::PhantomData::) } } unsafe impl ::windows_core::ComInterface for IIterable { const IID: ::windows_core::GUID = ::windows_core::GUID::from_signature( ::SIGNATURE, ); } #[repr(C)] #[doc(hidden)] pub struct IIterable_Vtbl where T: ::windows_core::RuntimeType + 'static, { pub base__: ::windows_core::IInspectable_Vtbl, pub First: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut *mut ::core::ffi::c_void, ) -> ::windows_core::HRESULT, pub T: ::core::marker::PhantomData, } #[repr(transparent)] pub struct IIterator(::windows_core::IUnknown, ::core::marker::PhantomData) where T: ::windows_core::RuntimeType + 'static; impl IIterator { pub fn Current(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Current)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn HasCurrent(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).HasCurrent)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn MoveNext(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).MoveNext)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn GetMany( &self, items: &mut [>::Default], ) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).GetMany)( ::windows_core::Interface::as_raw(this), items.len() as u32, ::core::mem::transmute_copy(&items), &mut result__, ) .from_abi(result__) } } } impl ::windows_core::CanInto<::windows_core::IUnknown> for IIterator { } impl ::windows_core::CanInto<::windows_core::IInspectable> for IIterator { } impl ::core::cmp::PartialEq for IIterator { fn eq(&self, other: &Self) -> bool { self.0 == other.0 } } impl ::core::cmp::Eq for IIterator {} impl ::core::fmt::Debug for IIterator { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_tuple("IIterator").field(&self.0).finish() } } impl ::windows_core::RuntimeType for IIterator { const SIGNATURE: ::windows_core::imp::ConstBuffer = { ::windows_core::imp::ConstBuffer::new() .push_slice(b"pinterface(") .push_slice(b"{6a79e863-4300-459a-9966-cbb660963ee1}") .push_slice(b";") .push_other(::SIGNATURE) .push_slice(b")") }; } impl ::core::iter::Iterator for IIterator { type Item = T; fn next(&mut self) -> ::core::option::Option { let result = self.Current().ok(); if result.is_some() { self.MoveNext().ok()?; } result } } unsafe impl ::windows_core::Interface for IIterator { type Vtable = IIterator_Vtbl; } impl ::core::clone::Clone for IIterator { fn clone(&self) -> Self { Self(self.0.clone(), ::core::marker::PhantomData::) } } unsafe impl ::windows_core::ComInterface for IIterator { const IID: ::windows_core::GUID = ::windows_core::GUID::from_signature( ::SIGNATURE, ); } #[repr(C)] #[doc(hidden)] pub struct IIterator_Vtbl where T: ::windows_core::RuntimeType + 'static, { pub base__: ::windows_core::IInspectable_Vtbl, pub Current: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::windows_core::AbiType, ) -> ::windows_core::HRESULT, pub HasCurrent: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut bool, ) -> ::windows_core::HRESULT, pub MoveNext: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut bool, ) -> ::windows_core::HRESULT, pub GetMany: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, items_array_size: u32, items: *mut ::windows_core::AbiType, result__: *mut u32, ) -> ::windows_core::HRESULT, pub T: ::core::marker::PhantomData, } #[repr(transparent)] pub struct IVectorView(::windows_core::IUnknown, ::core::marker::PhantomData) where T: ::windows_core::RuntimeType + 'static; impl IVectorView { pub fn GetAt(&self, index: u32) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).GetAt)( ::windows_core::Interface::as_raw(this), index, &mut result__, ) .from_abi(result__) } } pub fn Size(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Size)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn IndexOf(&self, value: P0, index: &mut u32) -> ::windows_core::Result where P0: ::windows_core::IntoParam, { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).IndexOf)( ::windows_core::Interface::as_raw(this), value.into_param().abi(), index, &mut result__, ) .from_abi(result__) } } pub fn GetMany( &self, startindex: u32, items: &mut [>::Default], ) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).GetMany)( ::windows_core::Interface::as_raw(this), startindex, items.len() as u32, ::core::mem::transmute_copy(&items), &mut result__, ) .from_abi(result__) } } pub fn First(&self) -> ::windows_core::Result> { let this = &::windows_core::ComInterface::cast::>(self)?; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).First)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } } impl ::windows_core::CanInto<::windows_core::IUnknown> for IVectorView { } impl ::windows_core::CanInto<::windows_core::IInspectable> for IVectorView { } impl ::windows_core::CanTryInto> for IVectorView { } impl ::core::cmp::PartialEq for IVectorView { fn eq(&self, other: &Self) -> bool { self.0 == other.0 } } impl ::core::cmp::Eq for IVectorView {} impl ::core::fmt::Debug for IVectorView { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_tuple("IVectorView").field(&self.0).finish() } } impl ::windows_core::RuntimeType for IVectorView { const SIGNATURE: ::windows_core::imp::ConstBuffer = { ::windows_core::imp::ConstBuffer::new() .push_slice(b"pinterface(") .push_slice(b"{bbe1fa4c-b0e3-4583-baef-1f1b2e483e56}") .push_slice(b";") .push_other(::SIGNATURE) .push_slice(b")") }; } pub struct VectorViewIterator { vector: ::core::option::Option>, current: u32, } impl VectorViewIterator { pub fn new(vector: ::core::option::Option>) -> Self { Self { vector, current: 0 } } } impl ::core::iter::Iterator for VectorViewIterator { type Item = T; fn next(&mut self) -> ::core::option::Option { self.vector .as_ref() .and_then(|vector| vector.GetAt(self.current).ok()) .and_then(|result| { self.current += 1; Some(result) }) } } impl ::core::iter::IntoIterator for IVectorView { type Item = T; type IntoIter = VectorViewIterator; fn into_iter(self) -> Self::IntoIter { ::core::iter::IntoIterator::into_iter(&self) } } impl ::core::iter::IntoIterator for &IVectorView { type Item = T; type IntoIter = VectorViewIterator; fn into_iter(self) -> Self::IntoIter { VectorViewIterator::new(::core::option::Option::Some(::core::clone::Clone::clone( self, ))) } } unsafe impl ::windows_core::Interface for IVectorView { type Vtable = IVectorView_Vtbl; } impl ::core::clone::Clone for IVectorView { fn clone(&self) -> Self { Self(self.0.clone(), ::core::marker::PhantomData::) } } unsafe impl ::windows_core::ComInterface for IVectorView { const IID: ::windows_core::GUID = ::windows_core::GUID::from_signature( ::SIGNATURE, ); } #[repr(C)] #[doc(hidden)] pub struct IVectorView_Vtbl where T: ::windows_core::RuntimeType + 'static, { pub base__: ::windows_core::IInspectable_Vtbl, pub GetAt: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, index: u32, result__: *mut ::windows_core::AbiType, ) -> ::windows_core::HRESULT, pub Size: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut u32, ) -> ::windows_core::HRESULT, pub IndexOf: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: ::windows_core::AbiType, index: *mut u32, result__: *mut bool, ) -> ::windows_core::HRESULT, pub GetMany: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, startindex: u32, items_array_size: u32, items: *mut ::windows_core::AbiType, result__: *mut u32, ) -> ::windows_core::HRESULT, pub T: ::core::marker::PhantomData, } } #[repr(C)] pub struct DateTime { pub UniversalTime: i64, } impl ::core::marker::Copy for DateTime {} impl ::core::clone::Clone for DateTime { fn clone(&self) -> Self { *self } } impl ::core::fmt::Debug for DateTime { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("DateTime") .field("UniversalTime", &self.UniversalTime) .finish() } } impl ::windows_core::TypeKind for DateTime { type TypeKind = ::windows_core::CopyType; } impl ::windows_core::RuntimeType for DateTime { const SIGNATURE: ::windows_core::imp::ConstBuffer = ::windows_core::imp::ConstBuffer::from_slice(b"struct(Windows.Foundation.DateTime;i8)"); } impl ::core::cmp::PartialEq for DateTime { fn eq(&self, other: &Self) -> bool { self.UniversalTime == other.UniversalTime } } impl ::core::cmp::Eq for DateTime {} impl ::core::default::Default for DateTime { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[repr(C)] pub struct TimeSpan { pub Duration: i64, } impl ::core::marker::Copy for TimeSpan {} impl ::core::clone::Clone for TimeSpan { fn clone(&self) -> Self { *self } } impl ::core::fmt::Debug for TimeSpan { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_struct("TimeSpan") .field("Duration", &self.Duration) .finish() } } impl ::windows_core::TypeKind for TimeSpan { type TypeKind = ::windows_core::CopyType; } impl ::windows_core::RuntimeType for TimeSpan { const SIGNATURE: ::windows_core::imp::ConstBuffer = ::windows_core::imp::ConstBuffer::from_slice(b"struct(Windows.Foundation.TimeSpan;i8)"); } impl ::core::cmp::PartialEq for TimeSpan { fn eq(&self, other: &Self) -> bool { self.Duration == other.Duration } } impl ::core::cmp::Eq for TimeSpan {} impl ::core::default::Default for TimeSpan { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::convert::From<::core::time::Duration> for TimeSpan { fn from(value: ::core::time::Duration) -> Self { Self { Duration: (value.as_nanos() / 100) as i64, } } } impl ::core::convert::From for ::core::time::Duration { fn from(value: TimeSpan) -> Self { ::core::time::Duration::from_nanos((value.Duration * 100) as u64) } } } pub mod Globalization { #[doc(hidden)] #[repr(transparent)] pub struct ICalendar(::windows_core::IUnknown); unsafe impl ::windows_core::Interface for ICalendar { type Vtable = ICalendar_Vtbl; } impl ::core::clone::Clone for ICalendar { fn clone(&self) -> Self { Self(self.0.clone()) } } unsafe impl ::windows_core::ComInterface for ICalendar { const IID: ::windows_core::GUID = ::windows_core::GUID::from_u128(0xca30221d_86d9_40fb_a26b_d44eb7cf08ea); } #[repr(C)] #[doc(hidden)] pub struct ICalendar_Vtbl { pub base__: ::windows_core::IInspectable_Vtbl, pub Clone: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut *mut ::core::ffi::c_void, ) -> ::windows_core::HRESULT, pub SetToMin: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> ::windows_core::HRESULT, pub SetToMax: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> ::windows_core::HRESULT, pub Languages: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut *mut ::core::ffi::c_void, ) -> ::windows_core::HRESULT, pub NumeralSystem: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub SetNumeralSystem: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub GetCalendarSystem: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub ChangeCalendarSystem: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub GetClock: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub ChangeClock: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub GetDateTime: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut super::Foundation::DateTime, ) -> ::windows_core::HRESULT, pub SetDateTime: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: super::Foundation::DateTime, ) -> ::windows_core::HRESULT, pub SetToNow: unsafe extern "system" fn(this: *mut ::core::ffi::c_void) -> ::windows_core::HRESULT, pub FirstEra: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub LastEra: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub NumberOfEras: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub Era: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub SetEra: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: i32, ) -> ::windows_core::HRESULT, pub AddEras: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, eras: i32, ) -> ::windows_core::HRESULT, pub EraAsFullString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub EraAsString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, ideallength: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub FirstYearInThisEra: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub LastYearInThisEra: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub NumberOfYearsInThisEra: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub Year: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub SetYear: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: i32, ) -> ::windows_core::HRESULT, pub AddYears: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, years: i32, ) -> ::windows_core::HRESULT, pub YearAsString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub YearAsTruncatedString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, remainingdigits: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub YearAsPaddedString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, mindigits: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub FirstMonthInThisYear: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub LastMonthInThisYear: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub NumberOfMonthsInThisYear: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub Month: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub SetMonth: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: i32, ) -> ::windows_core::HRESULT, pub AddMonths: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, months: i32, ) -> ::windows_core::HRESULT, pub MonthAsFullString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub MonthAsString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, ideallength: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub MonthAsFullSoloString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub MonthAsSoloString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, ideallength: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub MonthAsNumericString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub MonthAsPaddedNumericString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, mindigits: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub AddWeeks: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, weeks: i32, ) -> ::windows_core::HRESULT, pub FirstDayInThisMonth: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub LastDayInThisMonth: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub NumberOfDaysInThisMonth: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub Day: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub SetDay: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: i32, ) -> ::windows_core::HRESULT, pub AddDays: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, days: i32, ) -> ::windows_core::HRESULT, pub DayAsString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub DayAsPaddedString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, mindigits: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub DayOfWeek: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut DayOfWeek, ) -> ::windows_core::HRESULT, pub DayOfWeekAsFullString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub DayOfWeekAsString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, ideallength: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub DayOfWeekAsFullSoloString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub DayOfWeekAsSoloString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, ideallength: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub FirstPeriodInThisDay: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub LastPeriodInThisDay: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub NumberOfPeriodsInThisDay: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub Period: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub SetPeriod: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: i32, ) -> ::windows_core::HRESULT, pub AddPeriods: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, periods: i32, ) -> ::windows_core::HRESULT, pub PeriodAsFullString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub PeriodAsString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, ideallength: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub FirstHourInThisPeriod: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub LastHourInThisPeriod: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub NumberOfHoursInThisPeriod: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub Hour: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub SetHour: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: i32, ) -> ::windows_core::HRESULT, pub AddHours: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, hours: i32, ) -> ::windows_core::HRESULT, pub HourAsString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub HourAsPaddedString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, mindigits: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub Minute: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub SetMinute: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: i32, ) -> ::windows_core::HRESULT, pub AddMinutes: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, minutes: i32, ) -> ::windows_core::HRESULT, pub MinuteAsString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub MinuteAsPaddedString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, mindigits: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub Second: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub SetSecond: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: i32, ) -> ::windows_core::HRESULT, pub AddSeconds: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, seconds: i32, ) -> ::windows_core::HRESULT, pub SecondAsString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub SecondAsPaddedString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, mindigits: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub Nanosecond: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub SetNanosecond: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, value: i32, ) -> ::windows_core::HRESULT, pub AddNanoseconds: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, nanoseconds: i32, ) -> ::windows_core::HRESULT, pub NanosecondAsString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub NanosecondAsPaddedString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, mindigits: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub Compare: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, other: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub CompareDateTime: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, other: super::Foundation::DateTime, result__: *mut i32, ) -> ::windows_core::HRESULT, pub CopyTo: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, other: *mut ::core::ffi::c_void, ) -> ::windows_core::HRESULT, pub FirstMinuteInThisHour: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub LastMinuteInThisHour: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub NumberOfMinutesInThisHour: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub FirstSecondInThisMinute: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub LastSecondInThisMinute: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub NumberOfSecondsInThisMinute: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut i32, ) -> ::windows_core::HRESULT, pub ResolvedLanguage: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub IsDaylightSavingTime: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut bool, ) -> ::windows_core::HRESULT, } #[doc(hidden)] #[repr(transparent)] pub struct ICalendarFactory(::windows_core::IUnknown); unsafe impl ::windows_core::Interface for ICalendarFactory { type Vtable = ICalendarFactory_Vtbl; } impl ::core::clone::Clone for ICalendarFactory { fn clone(&self) -> Self { Self(self.0.clone()) } } unsafe impl ::windows_core::ComInterface for ICalendarFactory { const IID: ::windows_core::GUID = ::windows_core::GUID::from_u128(0x83f58412_e56b_4c75_a66e_0f63d57758a6); } #[repr(C)] #[doc(hidden)] pub struct ICalendarFactory_Vtbl { pub base__: ::windows_core::IInspectable_Vtbl, pub CreateCalendarDefaultCalendarAndClock: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, languages: *mut ::core::ffi::c_void, result__: *mut *mut ::core::ffi::c_void, ) -> ::windows_core::HRESULT, pub CreateCalendar: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, languages: *mut ::core::ffi::c_void, calendar: ::std::mem::MaybeUninit<::windows_core::HSTRING>, clock: ::std::mem::MaybeUninit<::windows_core::HSTRING>, result__: *mut *mut ::core::ffi::c_void, ) -> ::windows_core::HRESULT, } #[doc(hidden)] #[repr(transparent)] pub struct ICalendarFactory2(::windows_core::IUnknown); unsafe impl ::windows_core::Interface for ICalendarFactory2 { type Vtable = ICalendarFactory2_Vtbl; } impl ::core::clone::Clone for ICalendarFactory2 { fn clone(&self) -> Self { Self(self.0.clone()) } } unsafe impl ::windows_core::ComInterface for ICalendarFactory2 { const IID: ::windows_core::GUID = ::windows_core::GUID::from_u128(0xb44b378c_ca7e_4590_9e72_ea2bec1a5115); } #[repr(C)] #[doc(hidden)] pub struct ICalendarFactory2_Vtbl { pub base__: ::windows_core::IInspectable_Vtbl, pub CreateCalendarWithTimeZone: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, languages: *mut ::core::ffi::c_void, calendar: ::std::mem::MaybeUninit<::windows_core::HSTRING>, clock: ::std::mem::MaybeUninit<::windows_core::HSTRING>, timezoneid: ::std::mem::MaybeUninit<::windows_core::HSTRING>, result__: *mut *mut ::core::ffi::c_void, ) -> ::windows_core::HRESULT, } #[doc(hidden)] #[repr(transparent)] pub struct ITimeZoneOnCalendar(::windows_core::IUnknown); unsafe impl ::windows_core::Interface for ITimeZoneOnCalendar { type Vtable = ITimeZoneOnCalendar_Vtbl; } impl ::core::clone::Clone for ITimeZoneOnCalendar { fn clone(&self) -> Self { Self(self.0.clone()) } } unsafe impl ::windows_core::ComInterface for ITimeZoneOnCalendar { const IID: ::windows_core::GUID = ::windows_core::GUID::from_u128(0xbb3c25e5_46cf_4317_a3f5_02621ad54478); } #[repr(C)] #[doc(hidden)] pub struct ITimeZoneOnCalendar_Vtbl { pub base__: ::windows_core::IInspectable_Vtbl, pub GetTimeZone: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub ChangeTimeZone: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, timezoneid: ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub TimeZoneAsFullString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, pub TimeZoneAsString: unsafe extern "system" fn( this: *mut ::core::ffi::c_void, ideallength: i32, result__: *mut ::std::mem::MaybeUninit<::windows_core::HSTRING>, ) -> ::windows_core::HRESULT, } #[repr(transparent)] pub struct Calendar(::windows_core::IUnknown); 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__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Clone)( ::windows_core::Interface::as_raw(this), &mut result__, ) .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 Languages( &self, ) -> ::windows_core::Result< super::Foundation::Collections::IVectorView<::windows_core::HSTRING>, > { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Languages)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn NumeralSystem(&self) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).NumeralSystem)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(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<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).GetCalendarSystem)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(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<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).GetClock)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(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 GetDateTime(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).GetDateTime)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn SetDateTime( &self, value: super::Foundation::DateTime, ) -> ::windows_core::Result<()> { let this = self; unsafe { (::windows_core::Interface::vtable(this).SetDateTime)( ::windows_core::Interface::as_raw(this), 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__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).FirstEra)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn LastEra(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).LastEra)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn NumberOfEras(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).NumberOfEras)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn Era(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Era)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(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<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).EraAsFullString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn EraAsString( &self, ideallength: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).EraAsString)( ::windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .from_abi(result__) } } pub fn FirstYearInThisEra(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).FirstYearInThisEra)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn LastYearInThisEra(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).LastYearInThisEra)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn NumberOfYearsInThisEra(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).NumberOfYearsInThisEra)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn Year(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Year)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(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<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).YearAsString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn YearAsTruncatedString( &self, remainingdigits: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).YearAsTruncatedString)( ::windows_core::Interface::as_raw(this), remainingdigits, &mut result__, ) .from_abi(result__) } } pub fn YearAsPaddedString( &self, mindigits: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).YearAsPaddedString)( ::windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .from_abi(result__) } } pub fn FirstMonthInThisYear(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).FirstMonthInThisYear)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn LastMonthInThisYear(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).LastMonthInThisYear)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn NumberOfMonthsInThisYear(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).NumberOfMonthsInThisYear)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn Month(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Month)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(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<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).MonthAsFullString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn MonthAsString( &self, ideallength: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).MonthAsString)( ::windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .from_abi(result__) } } pub fn MonthAsFullSoloString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).MonthAsFullSoloString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn MonthAsSoloString( &self, ideallength: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).MonthAsSoloString)( ::windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .from_abi(result__) } } pub fn MonthAsNumericString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).MonthAsNumericString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn MonthAsPaddedNumericString( &self, mindigits: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).MonthAsPaddedNumericString)( ::windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .from_abi(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__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).FirstDayInThisMonth)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn LastDayInThisMonth(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).LastDayInThisMonth)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn NumberOfDaysInThisMonth(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).NumberOfDaysInThisMonth)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn Day(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Day)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(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<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).DayAsString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn DayAsPaddedString( &self, mindigits: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).DayAsPaddedString)( ::windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .from_abi(result__) } } pub fn DayOfWeek(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).DayOfWeek)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn DayOfWeekAsFullString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).DayOfWeekAsFullString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn DayOfWeekAsString( &self, ideallength: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).DayOfWeekAsString)( ::windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .from_abi(result__) } } pub fn DayOfWeekAsFullSoloString(&self) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).DayOfWeekAsFullSoloString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn DayOfWeekAsSoloString( &self, ideallength: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).DayOfWeekAsSoloString)( ::windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .from_abi(result__) } } pub fn FirstPeriodInThisDay(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).FirstPeriodInThisDay)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn LastPeriodInThisDay(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).LastPeriodInThisDay)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn NumberOfPeriodsInThisDay(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).NumberOfPeriodsInThisDay)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn Period(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Period)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(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<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).PeriodAsFullString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn PeriodAsString( &self, ideallength: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).PeriodAsString)( ::windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .from_abi(result__) } } pub fn FirstHourInThisPeriod(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).FirstHourInThisPeriod)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn LastHourInThisPeriod(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).LastHourInThisPeriod)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn NumberOfHoursInThisPeriod(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).NumberOfHoursInThisPeriod)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn Hour(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Hour)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(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<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).HourAsString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn HourAsPaddedString( &self, mindigits: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).HourAsPaddedString)( ::windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .from_abi(result__) } } pub fn Minute(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Minute)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(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<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).MinuteAsString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn MinuteAsPaddedString( &self, mindigits: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).MinuteAsPaddedString)( ::windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .from_abi(result__) } } pub fn Second(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Second)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(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<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).SecondAsString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn SecondAsPaddedString( &self, mindigits: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).SecondAsPaddedString)( ::windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .from_abi(result__) } } pub fn Nanosecond(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Nanosecond)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(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<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).NanosecondAsString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn NanosecondAsPaddedString( &self, mindigits: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).NanosecondAsPaddedString)( ::windows_core::Interface::as_raw(this), mindigits, &mut result__, ) .from_abi(result__) } } pub fn Compare(&self, other: P0) -> ::windows_core::Result where P0: ::windows_core::IntoParam, { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).Compare)( ::windows_core::Interface::as_raw(this), other.into_param().abi(), &mut result__, ) .from_abi(result__) } } pub fn CompareDateTime( &self, other: super::Foundation::DateTime, ) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).CompareDateTime)( ::windows_core::Interface::as_raw(this), other, &mut result__, ) .from_abi(result__) } } pub fn CopyTo(&self, other: P0) -> ::windows_core::Result<()> where P0: ::windows_core::IntoParam, { let this = self; unsafe { (::windows_core::Interface::vtable(this).CopyTo)( ::windows_core::Interface::as_raw(this), other.into_param().abi(), ) .ok() } } pub fn FirstMinuteInThisHour(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).FirstMinuteInThisHour)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn LastMinuteInThisHour(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).LastMinuteInThisHour)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn NumberOfMinutesInThisHour(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).NumberOfMinutesInThisHour)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn FirstSecondInThisMinute(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).FirstSecondInThisMinute)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn LastSecondInThisMinute(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).LastSecondInThisMinute)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn NumberOfSecondsInThisMinute(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).NumberOfSecondsInThisMinute)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn ResolvedLanguage(&self) -> ::windows_core::Result<::windows_core::HSTRING> { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).ResolvedLanguage)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn IsDaylightSavingTime(&self) -> ::windows_core::Result { let this = self; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).IsDaylightSavingTime)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn CreateCalendarDefaultCalendarAndClock( languages: P0, ) -> ::windows_core::Result where P0: ::windows_core::TryIntoParam< super::Foundation::Collections::IIterable<::windows_core::HSTRING>, >, { Self::ICalendarFactory(|this| unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).CreateCalendarDefaultCalendarAndClock)( ::windows_core::Interface::as_raw(this), languages.try_into_param()?.abi(), &mut result__, ) .from_abi(result__) }) } pub fn CreateCalendar( languages: P0, calendar: &::windows_core::HSTRING, clock: &::windows_core::HSTRING, ) -> ::windows_core::Result where P0: ::windows_core::TryIntoParam< super::Foundation::Collections::IIterable<::windows_core::HSTRING>, >, { Self::ICalendarFactory(|this| unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).CreateCalendar)( ::windows_core::Interface::as_raw(this), languages.try_into_param()?.abi(), ::core::mem::transmute_copy(calendar), ::core::mem::transmute_copy(clock), &mut result__, ) .from_abi(result__) }) } pub fn CreateCalendarWithTimeZone( languages: P0, calendar: &::windows_core::HSTRING, clock: &::windows_core::HSTRING, timezoneid: &::windows_core::HSTRING, ) -> ::windows_core::Result where P0: ::windows_core::TryIntoParam< super::Foundation::Collections::IIterable<::windows_core::HSTRING>, >, { Self::ICalendarFactory2(|this| unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).CreateCalendarWithTimeZone)( ::windows_core::Interface::as_raw(this), languages.try_into_param()?.abi(), ::core::mem::transmute_copy(calendar), ::core::mem::transmute_copy(clock), ::core::mem::transmute_copy(timezoneid), &mut result__, ) .from_abi(result__) }) } pub fn GetTimeZone(&self) -> ::windows_core::Result<::windows_core::HSTRING> { let this = &::windows_core::ComInterface::cast::(self)?; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).GetTimeZone)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn ChangeTimeZone( &self, timezoneid: &::windows_core::HSTRING, ) -> ::windows_core::Result<()> { let this = &::windows_core::ComInterface::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<::windows_core::HSTRING> { let this = &::windows_core::ComInterface::cast::(self)?; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).TimeZoneAsFullString)( ::windows_core::Interface::as_raw(this), &mut result__, ) .from_abi(result__) } } pub fn TimeZoneAsString( &self, ideallength: i32, ) -> ::windows_core::Result<::windows_core::HSTRING> { let this = &::windows_core::ComInterface::cast::(self)?; unsafe { let mut result__ = ::std::mem::zeroed(); (::windows_core::Interface::vtable(this).TimeZoneAsString)( ::windows_core::Interface::as_raw(this), ideallength, &mut result__, ) .from_abi(result__) } } #[doc(hidden)] pub fn ICalendarFactory ::windows_core::Result>( callback: F, ) -> ::windows_core::Result { static SHARED: ::windows_core::imp::FactoryCache = ::windows_core::imp::FactoryCache::new(); SHARED.call(callback) } #[doc(hidden)] pub 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 ::core::cmp::PartialEq for Calendar { fn eq(&self, other: &Self) -> bool { self.0 == other.0 } } impl ::core::cmp::Eq for Calendar {} impl ::core::fmt::Debug for Calendar { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_tuple("Calendar").field(&self.0).finish() } } impl ::windows_core::RuntimeType for Calendar { const SIGNATURE: ::windows_core::imp::ConstBuffer = ::windows_core::imp::ConstBuffer::from_slice( b"rc(Windows.Globalization.Calendar;{ca30221d-86d9-40fb-a26b-d44eb7cf08ea})", ); } impl ::core::clone::Clone for Calendar { fn clone(&self) -> Self { Self(self.0.clone()) } } unsafe impl ::windows_core::Interface for Calendar { type Vtable = ICalendar_Vtbl; } unsafe impl ::windows_core::ComInterface for Calendar { const IID: ::windows_core::GUID = ::IID; } impl ::windows_core::RuntimeName for Calendar { const NAME: &'static str = "Windows.Globalization.Calendar"; } ::windows_core::imp::interface_hierarchy!( Calendar, ::windows_core::IUnknown, ::windows_core::IInspectable ); unsafe impl ::core::marker::Send for Calendar {} unsafe impl ::core::marker::Sync for Calendar {} #[repr(transparent)] #[derive(::core::cmp::PartialEq, ::core::cmp::Eq)] pub struct DayOfWeek(pub i32); impl DayOfWeek { pub const Sunday: Self = Self(0i32); pub const Monday: Self = Self(1i32); pub const Tuesday: Self = Self(2i32); pub const Wednesday: Self = Self(3i32); pub const Thursday: Self = Self(4i32); pub const Friday: Self = Self(5i32); pub const Saturday: Self = Self(6i32); } impl ::core::marker::Copy for DayOfWeek {} impl ::core::clone::Clone for DayOfWeek { fn clone(&self) -> Self { *self } } impl ::core::default::Default for DayOfWeek { fn default() -> Self { Self(0) } } impl ::windows_core::TypeKind for DayOfWeek { type TypeKind = ::windows_core::CopyType; } impl ::core::fmt::Debug for DayOfWeek { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { f.debug_tuple("DayOfWeek").field(&self.0).finish() } } impl ::windows_core::RuntimeType for DayOfWeek { const SIGNATURE: ::windows_core::imp::ConstBuffer = ::windows_core::imp::ConstBuffer::from_slice( b"enum(Windows.Globalization.DayOfWeek;i4)", ); } } iana-time-zone-0.1.60/src/ffi_utils.rs000064400000000000000000000034221046102023000156470ustar 00000000000000//! Cross platform FFI helpers. use std::ffi::CStr; // 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. const ANDROID_TIMEZONE_PROPERTY_NAME: &[u8] = b"persist.sys.timezone\0"; /// Return a [`CStr`] to access the timezone from an Android system properties /// environment. 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 std::ffi::CStr; 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(); } } iana-time-zone-0.1.60/src/lib.rs000064400000000000000000000064001046102023000144300ustar 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: //! ```ignore //! let tz_str = iana_time_zone::get_timezone()?; //! let tz: chrono_tz::Tz = tz_str.parse()?; //! ``` #[allow(dead_code)] mod ffi_utils; #[cfg_attr(any(target_os = "linux", target_os = "hurd"), path = "tz_linux.rs")] #[cfg_attr(target_os = "windows", path = "tz_windows.rs")] #[cfg_attr(any(target_os = "macos", target_os = "ios"), path = "tz_macos.rs")] #[cfg_attr( all(target_arch = "wasm32", not(target_os = "wasi")), path = "tz_wasm32.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.60/src/platform.rs000064400000000000000000000005451046102023000155120ustar 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.60/src/tz_aix.rs000064400000000000000000000015641046102023000151660ustar 00000000000000use std::fs::OpenOptions; use std::io::{BufRead, BufReader}; use std::env; pub(crate) fn get_timezone_inner() -> Result { env::var("TZ").map_err(|_| crate::GetTimezoneError::OsError) } fn read_environment() -> Result { // https://www.ibm.com/docs/en/aix/7.2?topic=files-environment-file let file = OpenOptions::new().read(true).open("/etc/environment")?; let mut reader = BufReader::new(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.60/src/tz_android.rs000064400000000000000000000016501046102023000160210ustar 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.60/src/tz_freebsd.rs000064400000000000000000000005341046102023000160130ustar 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.60/src/tz_haiku.rs000064400000000000000000000002431046102023000154770ustar 00000000000000pub(crate) fn get_timezone_inner() -> Result { iana_time_zone_haiku::get_timezone().ok_or(crate::GetTimezoneError::OsError) } iana-time-zone-0.1.60/src/tz_illumos.rs000064400000000000000000000014371046102023000160700ustar 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.60/src/tz_linux.rs000064400000000000000000000151231046102023000155400ustar 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_else(|| 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.60/src/tz_macos.rs000064400000000000000000000115441046102023000155060ustar 00000000000000pub(crate) fn get_timezone_inner() -> Result { get_timezone().ok_or(crate::GetTimezoneError::OsError) } #[inline] fn get_timezone() -> Option { // The longest name in the IANA time zone database is 25 ASCII characters long. const MAX_LEN: usize = 32; let mut buf = [0; MAX_LEN]; // 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. 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}; 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 { pub(crate) fn new() -> Option { // SAFETY: No invariants to uphold. We'll release the pointer when we don't need it anymore. let v: CFTimeZoneRef = unsafe { CFTimeZoneCopySystem() }; if v.is_null() { None } else { Some(SystemTimeZone(v)) } } /// Get the time zone name as a [super::string_ref::StringRef]. /// /// The lifetime of the `StringRef` is bound to our lifetime. Mutable /// access is also prevented by taking a reference to `self`. 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 std::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: `StringRef` 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. 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, }; let converted_bytes = unsafe { // SAFETY: `StringRef` is only ever created with a valid `CFStringRef`. 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.60/src/tz_netbsd.rs000064400000000000000000000015571046102023000156660ustar 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.60/src/tz_wasm32.rs000064400000000000000000000011321046102023000155100ustar 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.60/src/tz_windows.rs000064400000000000000000000010501046102023000160650ustar 00000000000000#[path = "Windows.rs"] #[allow(missing_debug_implementations, clippy::undocumented_unsafe_blocks)] mod windows; use 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()) }