Message-ID: <4A03D574.8070006@redfish-solutions.com>
Date: Fri, 08 May 2009 00:47:16 -0600
From: Philip Prindeville <philipp@redfish-solutions.com>
User-Agent: Thunderbird 2.0.0.19 (X11/20090105)
MIME-Version: 1.0
To: "Olson, Arthur David (NIH/NCI) [E]" <olsona@dc37a.nci.nih.gov>
Subject: Re: Generating "TZ" string from /etc/localtime?
References: <49CED19E.8020504@redfish-solutions.com>
 <B410D30A78C6404C9DABEA31B54A2813033221E6@nihcesmlbx10.nih.gov>
 <49CF16B3.6010602@redfish-solutions.com>
 <B410D30A78C6404C9DABEA31B54A2813029A058A@nihcesmlbx10.nih.gov>
 <49D12EDF.2030500@redfish-solutions.com>
 <B410D30A78C6404C9DABEA31B54A2813029A058B@nihcesmlbx10.nih.gov>
In-Reply-To: <B410D30A78C6404C9DABEA31B54A2813029A058B@nihcesmlbx10.nih.gov>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Olson, Arthur David (NIH/NCI) [E] wrote:
>> I'll see if I can spend some quality time next week (a) trying to
>>     
> right 
>   
>> up a quick "helper" program to read the /etc/localtime file and write 
>> out a variable suitable for tzset() with the zone name, offset, DST
>>     
> zone 
>   
>> name, and DST start- and stop-dates... 
>>     
>
> On a UNIX/Linux system, for most zones doing a...
> 	tail -1 /etc/localtime
> ...will do the trick. The (non-error checking) Perl variant would be:
> 	open(S, "</etc/localtime");
> 	while (<S>) { $s = $_; }
> 	print $s;
>
> To see the situations where it won't work, do this:
> 	cd /whatever/the/root/of/the/zoneinfo/files/is/on/your/system
> 	for i in `find * -type f -print`
> 	do
> 		tail -1 $i | sed "s@^@$i	@"
> 	done
>
> Again, all this relies on version-2 time zone binary files.
>
> 				--ado
>
>   

What about adding API changes to allow:

(1) Extracting the name for u.buf[] after doing a tzload() of a
particular name[]...

(2) Given a timezone name, generate the equivalent:

    std offset dst [offset],start[/time],end[/time]

    string that describes it from the zoneinfo record matching that name[].

I'd do this myself, but it would be a while before I got to it.

-Philip






