rok commented on code in PR #12865: URL: https://github.com/apache/arrow/pull/12865#discussion_r2215270510
########## cpp/src/arrow/compute/kernels/temporal_internal.h: ########## @@ -40,15 +40,68 @@ using arrow_vendored::date::year_month_day; using arrow_vendored::date::zoned_time; using std::chrono::duration_cast; +// https://howardhinnant.github.io/date/tz.html#Examples +using ArrowTimeZone = std::variant<const time_zone*, OffsetZone>; + +// Utility struct for creating overloaded visitor functions from multiple lambdas. +// Inherits from all provided callable types and exposes their operator(). +// Usage: auto visitor = overloads{[](time_zone*){...}, [](OffsetZone){...}}; +// See https://en.cppreference.com/w/cpp/utility/variant/visit for reference +template <class... Ts> +struct overloads : Ts... { + using Ts::operator()...; +}; +template <class... Ts> +overloads(Ts...) -> overloads<Ts...>; + +template <class Duration, class Func> +auto ApplyTimeZone(const ArrowTimeZone& tz, sys_time<Duration> st, Func&& func) + -> decltype(func(zoned_time<Duration>{})) { + if (tz.index() == 0) { Review Comment: Ping @pitrou -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org