-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Linux system default zoneinfo #33
Comments
I'm not sure exactly what you're asking for. You can ask for the system's definition of its time zone by specifying the time zone name as I would like to have this distro be able to use the tz definition files directly, but that work's been stalled for a while. |
This is exactly what I need. At my workplace we would like to directly use the tz files from /usr/share/zoneinfo. DateTime::TimeZone is so well known and so widely used in the Perl community, we would like to avoid creating our own new library and tell our developers to switch. So it's best to have the support from within DateTime::TimeZone. Python's pytz, which is the equivalent of DateTime::TimeZone, ships a zoneinfo dir with itself, and it allows overrding the path via an env var. |
I see. No one is working on this feature right now, unfortunately. Years back a Perl person who goes by Zefram had a nearly done prototype of this. Unfortunately, he didn't quite finish this. He shared work in progress but it never ended up in a durable location so I can't get this and finish it. However, he does have a distro on CPAN that is probably good enough for your needs at https://metacpan.org/release/DateTime-TimeZone-Tzfile |
Some more findings today: Besides pytz I mentioned yesterday, Python's another library called dateutil (python-dateutil), intrinsically uses /usr/share/zoneinfo on Linux, and only uses its bundled TZ files as a fallback. So both of the two major Python timezone libraries supports TZ files and can easily use /usr/share/zoneinfo. I guess the performance impact of parsing TZ files is actually not much. On the contrary, the Perl timezone libraries cannot easily use /usr/share/zoneinfo. Both the two dominant ones, DateTime::TimeZone and Date::Manip convert TZ files to Perl modules, and do not support parsing/using TZ files. Zefram's DateTime::TimeZone::Olson uses TZ files, but it also ships Olson via his another library Time::OlsonTZ::Data which is not designed to allow an easy switch to /usr/share/zoneinfo. Also DateTime::TimeZone::Olson is so less known in the Perl community... |
Now this library bundles a converted Olson data with itself, and there is no way to use Linux system default zoneinfo. It becomes a problem if user does not keep their version of the library up-to-date. Python's pytz uses TZ format zoneinfo data and allows an env var for user to use system default zoneinfo.
The text was updated successfully, but these errors were encountered: