[tz] Reading binary files

Thom Hehl Thom at pointsix.com
Wed Nov 2 14:58:05 UTC 2011


Not if you are writing applications that need high performance
processing of multiple timezones and access from multiple languages and
platforms. Besides, we're multi-threaded. Changing environment variables
is simply not an option. Yikes! Can you say race condition.

 

From: bent at latency.net [mailto:bent at latency.net] On Behalf Of Bennett
Todd
Sent: Wednesday, November 02, 2011 9:09 AM
To: Thom Hehl
Subject: Re: [tz] Reading binary files

 

The binary files are a distraction.

What you want to do is set the environment variable TZ to the name of
the zone you want, then call tzset which is what consults the database
and prepares for conversion. Then localtime(3) will translate a time_t
(seconds since the epoch) to hours, minutes, seconds, etc in the local
timezone.

For translating back and forth you repeatedly reset TZ, call tzset(3),
and localtime(3). Those are the standards for Unix, the native home of
the zoneinfo database. If you're on a different system details may vary.
But on Unix the database is probably already installed in your system
and the subroutines you need are already compiled into the system
library.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mm.icann.org/pipermail/tz/attachments/20111102/f92125f4/attachment.htm>


More information about the tz mailing list