You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++][Python] strptime fails to parse with %p on Windows #31971
The vendored strptime implementation does support %p, but we have to disable it on Windows because the behavior is locale-dependent and it's not easy to support there.
(of course, we may support it in a non-locale-dependent way, i.e. always use the same values as a "C" Unix locale)
Joris Van den Bossche / @jorisvandenbossche:
We could maybe adapt the patch to the vendored strptime to raise a more informative error if it encounters %p if that is explicitly not supported?
PR #50146 (primarily about CSV date/time parsing) includes a fix for this: %p in the vendored musl strptime used on Windows was compiled out because nl_langinfo() (the source of the AM/PM strings) is unavailable there. The PR adds static C-locale tables, after which %p correctly adjusts %I hours on Windows (02:30 PM → 14:30). Validated on Windows CI across MinGW, MSVC, and ARM64 MSVC builds.
Activity
asfimport commentedon May 19, 2022
Antoine Pitrou / @pitrou:
As I said on the Linked GH issue:
asfimport commentedon May 19, 2022
Rok Mihevc / @rok:
Also see ARROW-16443
asfimport commentedon May 19, 2022
Antoine Pitrou / @pitrou:
For the record, here are the changes we applied to the vendored strptime:
https://gist.github.com/pitrou/d1d23ad2fdae4be34e737c14c8ae7443
You can see that, on Windows, we disable any locale-specific codes because they use
nl_langinfowhich is unavailable.asfimport commentedon May 31, 2022
Joris Van den Bossche / @jorisvandenbossche:
We could maybe adapt the patch to the vendored strptime to raise a more informative error if it encounters
%pif that is explicitly not supported?asfimport commentedon May 31, 2022
Rok Mihevc / @rok:
That would be useful indeed. Judging by ibis we might want to check %c, %x and %X too.
pearu commentedon Jun 11, 2026
PR #50146 (primarily about CSV date/time parsing) includes a fix for this:
%pin the vendored muslstrptimeused on Windows was compiled out becausenl_langinfo()(the source of the AM/PM strings) is unavailable there. The PR adds static C-locale tables, after which%pcorrectly adjusts%Ihours on Windows (02:30 PM→ 14:30). Validated on Windows CI across MinGW, MSVC, and ARM64 MSVC builds.