rok commented on PR #48601: URL: https://github.com/apache/arrow/pull/48601#issuecomment-3687604703
It seems that std::chrono on GCC (14.3.0, 15.2.0) potentially has a bug that triggers some of our [tests](https://github.com/apache/arrow/actions/runs/20446112128/job/58749804841?pr=48601). Meanwhile std::chrono on MSVC 19.44 ( 14.44) appears to be pass them and is correct or at least consistent with vendored `date.h`. I would therefore advise we only switch to std::chrono on MSVC for now as that gives us the most benefit anyway (users no longer have to deal with the tz db). Below is the explanation and reproduction of the bug. ```cpp // GCC libstdc++ DST bug reproduction // // The AN to AS Transition Bug // --------------------------- // Source https://github.com/eggert/tz/blob/c37fbc3249c1a1334948b38f3bca47dee5c11dd1/australasia#L165-L192 // Australia/Broken_Hill used the AN (New South Wales) rules until 2000, then // switched to AS (South Australia) rules. Under AN rules, DST started the last // Sunday of October and ended the last Sunday of March. For the 1999-2000 // summer, DST started October 31, 1999 and would end March 26, 2000. February // 29, 2000 falls squarely within this DST period, so the correct offset should // be 9:30 base + 1:00 DST = 10:30 (630 minutes). // // Why GCC's Data is Wrong // ----------------------- // When libstdc++ processes the zone transition from AN rules to AS rules (which // happens in year 2000), it appears to lose or reset the DST state inherited // from the AN rules. Instead of recognizing that DST is still active from the // October 1999 transition, it reports offset=570 (just the 9:30 base) with // save=0. The inconsistency is evident: it returns abbrev="ACDT" (daylight // time) but the offset and save values indicate standard time. The AN rules // clearly show DST should be active until the last Sunday of March 2000. // // Compile: g++ -std=c++20 -o gcc_dst_bug gcc_libstdcxx_dst_bug.cpp // Expected: 630 (10:30 = 9:30 base + 1:00 DST) // Actual: 570 (9:30 = base only, DST missing) #include <chrono> #include <iostream> int main() { using namespace std::chrono; auto* tz = locate_zone("Australia/Broken_Hill"); auto info = tz->get_info(sys_days{2000y / February / 29d} + 23h + 23min + 23s); std::cout << duration_cast<minutes>(info.offset).count() << "\n"; } ``` -- 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]
