pybind11
pybind11 copied to clipboard
changed localtime to gmtime to fix daylight savings issues
I was having issues with pybind using UTC times properly. As well, daylight savings datetimes were failing "roundtrip" tests.
Linked to this discussion: https://github.com/pybind/pybind11/discussions/3451#discussioncomment-2291585
I'm a noob here, so please, disregard readily and with prejudice if what I write does not jive with the spirit of the project.
It feels like localtime_thread_safe is a critical part of the contract for this cast, and that theres probably upstream customer assumptions around it, esp if its not a 1:1 conversion (as you said, daylight savings time can cause off-by-some-amount-of-time discrepancies).
It feels, then, like the right thing to do here would be make this a perfectly backward compatible change, via pre-processor macro, something like:
PYBIND11_USE_LEGACY_LOCAL_TIME (where the default is now the gmtime) (my preference)
or
PYBIND11_USE_GMTIME (where the default is the old behavior)