Jan MOEYERSONS wrote:
> 
> On Tue, 28 Feb 2012 12:17:46 -0600, Paul Gilmartin <paulgboul...@aim.com> 
> wrote:
> 
> >Set time zone with tzset().
> >
> >Call localtime() then strftime().
> >
> 
> I am not sure this will work correctly. The gmtime(), localtime() and 
> mktime() always use the daylight savings situation of the current date, not 
> of the date input to these functions. Which is an error, IMHO.
> 
> Cheers,
> 
> Jantje.

For historic local times, you'll need to add some logic to deal with the
changing start and stop of DST. DST started in 1966 and changed in 2007,
so if you have a date you want to convert that is in that range, first
do (for your particular time zone, this example is for the East
Coast...):

 setenv("TZ","EST5EDT,M3.2.0,M11.1.0"); 

If the year is 2007 or later, be sure to first reset to the current
value:

 setenv("TZ","EST5EDT,M4.1.0,M10.5.0"); 

Not as nice as TZDATA, but not rocket science.

-- 
Don Poitras - zSeries R & D  -  SAS Institute Inc. -  SAS Campus Drive 
mailto:sas...@sas.com   (919)531-5637  Fax:677-4444     Cary, NC 27513

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to