-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
The tzdb in libc++ are currently disabled on osx
llvm-project/libcxx/src/experimental/tzdb.cpp
Lines 50 to 56 in 3cecf17
| _LIBCPP_WEAK string_view __libcpp_tzdb_directory() { | |
| #if defined(__linux__) | |
| return "/usr/share/zoneinfo/"; | |
| #else | |
| # error "unknown path to the IANA Time Zone Database" | |
| #endif | |
| } |
However, the code itself (unsurprisingly) works fine also on osx, and we've enabled (and tested) it in our distribution (minus the leap-second bits, which need leap-seconds.list that's not shipped by default).
Presumably, the problem is where to find the tzdb, especially with any degree of consistency across different OS versions. I would have assumed that -- over time -- Apple would start shipping the necessary leap-seconds.list in whatever ends up being symlinked behind /usr/share/zoneinfo.
However, rather than this file getting added, it seems now that even the tzdata.zi that libc++ is using
llvm-project/libcxx/src/experimental/tzdb.cpp
Lines 675 to 676 in 3cecf17
| filesystem::path __root = chrono::__libcpp_tzdb_directory(); | |
| ifstream __tzdata{__root / "tzdata.zi"}; |
is getting removed? I noticed this when our tests started failing, and opened an issue on the repo where those images are mainained, where the information I got was
It seems that Apple has stopped providing the time zone data file because, for macOS, the primary representation of time zone data is now in binary format, rather than this auxiliary text file.
Is that true @ldionne? I mean yes, people can download tzdata themselves, extract it somewhere and point to that, but given that it's already on the system, it seems to me that the system should provide what libc++ uses -- or vice versa -- that libc++ uses what the system provides.
Long-term, in our distribution, we'll end up pointing libc++ to our own tzdata as soon as the chrono bits move out of the static libc++experimental.a (which we cannot patch without creating security holes) and into the dylib. But because many users are already wanting to use the tzdb-enabled <chrono>, and libc++ is the last C++ stdlib that doesn't have full support, I'm also interested in making sure these bits work before that happens.