Adarsh-Me opened a new pull request, #51315:
URL: https://github.com/apache/arrow/pull/51315
### Rationale for this change
GH-51267 tracks removing the vendored datetime fallback once all supported
toolchains provide working C++20 chrono timezone support. The backend selection
is currently hardcoded in `chrono_internal.h` (Windows-only) with no
build-level switch, and the vendored tz implementation is compiled into every
binary — including standard-backend ones.
### What changes are included in this PR?
- New `ARROW_USE_STD_CHRONO` CMake option (`AUTO`/`ON`/`OFF`, default
`AUTO`) resolved by a toolchain feature probe (`__cpp_lib_chrono >= 201907L`)
in `cpp/cmake_modules/CheckStdChrono.cmake`; new matching `use_std_chrono`
Meson feature option with the same semantics.
- `AUTO` preserves the current platform default (std::chrono on Windows
toolchains with timezone support, vendored fallback elsewhere) until the
minimum-toolchain prerequisites in GH-51267 are met. Explicit opt-in fails
loudly at configure time on unsupported toolchains.
- The resolved backend is recorded in `arrow/util/config.h` and honored by
`chrono_internal.h`; standard-backend binaries no longer build
`vendored/datetime.cpp`, and `config.cc` / the `SetTimezoneConfig` test honor
the selected backend (OS tzdb, no vendored `set_install`/`reload_tzdb`).
### Are these changes tested?
- CMake 3.31.6: verified the new module resolves `AUTO`→`OFF` on Linux/GCC
11, passes `OFF` through, fails configure on `ON` without toolchain support and
on invalid values; verified `config.h.cmake` renders `ARROW_USE_STD_CHRONO 0/1`
via real `configure_file`.
- Meson 1.7.2: verified `auto`/`disabled` keep the fallback and render `0`,
and `enabled` errors out on an unsupported toolchain.
- g++ 11 (C++20): compiled the real `vendored/datetime.cpp` plus a
functional test against the modified `chrono_internal.h` fallback path —
calendar round-trip, floor/ceil/trunc, `format`, `make_time`, `OffsetZone`, and
a live `locate_zone("America/New_York")` lookup against system zoneinfo all
pass; also confirmed the header selects the std branch when
`ARROW_USE_STD_CHRONO=1`.
- Full `ctest` matrix (notably Windows/MSVC and opt-in toolchains) left to
CI: this environment has no CMake project build deps and GCC 11 lacks
`<format>`/chrono-tz.
### Are there any user-facing changes?
New opt-in build options only; default builds behave exactly as before.
* GitHub Issue: #51267
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]