[tz] Reading binary files

Thom Hehl Thom at pointsix.com
Wed Nov 2 16:48:31 UTC 2011


BANG!!!!!!

Oops, sorry, shot before reading last sentence.

-----Original Message-----
From: Jaakko Hyvätti [mailto:jaakko.hyvatti at foreca.com] 
Sent: Wednesday, November 02, 2011 11:34 AM
To: Bennett Todd
Cc: Thom Hehl; tz at iana.org
Subject: Re: [tz] Reading binary files


I have done a version of C library that export the struct that contains 
zone definitions, and one can load many zones to these structs and call 
localtime etc. with the struct as a parameter.  Sorry cannot share that 
code, not that there is any secret in it but cannot spare the time at the 
moment to clean it up and export.  Just a hint that it is not a huge task 
to modify the current C library to be thread safe and efficient that way.
Just a hint. Don't shoot me for not sharing the actual code.

Jaakko

On Wed, 2 Nov 2011, Bennett Todd wrote:

> As far as I know, the choices for a high-speed timezone-switching
> implementation, thread-safe, are going to a different implementation (I
> don't know what would be best) or stashing the zoneinfo conversion in a
> separate process as a server, a tz conversion service.
> On Nov 2, 2011 11:05 AM, "Thom Hehl" <Thom at pointsix.com> wrote:
>
>> 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.****
>>
>

-- 
Foreca Ltd                                           Jaakko.Hyvatti at foreca.com
Tammasaarenkatu 5, FI-00180 Helsinki, Finland        http://www.foreca.com




More information about the tz mailing list