[lug] Zoneinfo round-tripping?

Chris Riddoch riddochc at gmail.com
Mon Mar 28 21:18:26 MDT 2016


I noticed those files were there... not sure what to make of them.
Should strftime be giving me those strings instead somehow? I spent a
little while skimming through things in the recent tzcode and tzdata
release to learn a bit about the "right" way to use these APIs. This
rabbit hole looks like it goes down pretty far...

There's some oddly fascinating historical trivia, but I also feel like
there's some diminishing returns on my time spent trying to figure
this all out myself.  I have the feeling we've got some folks around
here to know a lot more about timekeeping than I do.


On Mon, Mar 28, 2016 at 8:17 PM, Orion Poplawski <orion at cora.nwra.com> wrote:
> On 03/28/2016 08:09 PM, Chris Riddoch wrote:
>>
>> Hi, folks.
>>
>> This one's a bit of a puzzler for me - I'm getting similar behavior on
>> both Debian and Suse.  It seems the zoneinfo databases don't have
>> files (or symlinks or any sort of references) to make it possible to
>> look up zoneinfo from all the timezone abbreviations - but it does for
>> some of them.
>>
>> For example, 'zdump MST' and 'zdump EST' both return what I expected,
>> which caused me to think something that's apparently not true, because
>> 'zdump MDT' and 'zdump EDT' indicate a lookup failure.
>>
>> Should I not have expected the output of strftime's '%Z' to be a
>> string that I could look up in the zoneinfo database?
>>
>> I guess I need to be using the longer strings for locations that
>> zoneinfo *can* look up, like "America/Denver", which Suse puts in
>> /etc/sysconfig/clock and Debian puts in /etc/timezone, and apparently
>> doesn't need to be stored in a TZ environment variable somehow. is
>> there a common API that can be used to look up that longer string
>> across (at least) Linux distros?  Looking it up with strftime '%Z'
>> suddenly looks a lot less useful.
>>
>
> ls /usr/share/zoneinfo on my system suggests names like: MST7MDT, EST5EDT
> for the daylight savings time observing zones.
>
> --
> Orion Poplawski
> Technical Manager                     303-415-9701 x222
> NWRA/CoRA Division                    FAX: 303-415-9702
> 3380 Mitchell Lane                  orion at cora.nwra.com
> Boulder, CO 80301              http://www.cora.nwra.com
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety



-- 
Chris Riddoch
http://www.syntacticsugar.org/


More information about the LUG mailing list