Extension to tzcode to support additional timezones

Christos Zoulas christos at zoulas.com
Tue Oct 26 20:03:54 UTC 2010


On Oct 26,  3:18pm, christos at zoulas.com (Christos Zoulas) wrote:
-- Subject: Re: Extension to tzcode to support additional timezones

| On Oct 26, 12:13pm, eggert at cs.ucla.edu (Paul Eggert) wrote:
| -- Subject: Re: Extension to tzcode to support additional timezones
| 
| | On 10/26/10 12:08, Christos Zoulas wrote:
| | > Oh, and I've implemented the string pooling code already for tm_zone:
| | 
| | If we do that sort of thing, we need to take care that it's
| | thread-safe.
| 
| good point.
| 

So, the simplest way to do this is to with a pthread mutex (IMHO)
Other alternatives are:
	- use pthread once/pthread local (worse than using pthread mutex)
	- use c99 __thread (does not work everywhere)
	- use lockless structures (complex and possibly slow)
	- create an mmapped file with the universe of all possible
	  zone names using zic (again, complicated, os dependent etc.)
	  and then mmap and point to that for zone names.

BTW, tm->tm_zone is broken right now since it just does:

	tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];

and if I call tzset() with a different zone and try to lookup tmp->TM_ZONE
this will possibly point to junk.

Any other ideas or preferences?

christos



More information about the tz mailing list