Re: How to handle localtime() on old timestamps?
- From: Nelu <spamahead@xxxxxxxxx>
- Date: Fri, 11 May 2007 16:24:46 -0400
maruk2@xxxxxxxxxxx wrote:
I have some old data files with old timestamps, where
timestmap=time(NULL), some of them date back to the
year 1999.
localtime() seems to consider the presence of Daylight Saving
Time for the current day when it is actually called, but it does
not seem to consider the presence of Daylight Saving Time
for the old day.
For example, I run localtime on a timestamp from 3-22-1999
(Daylight Saving Time was not effective yet) today when Daylight
Saving Time is effective and localtime() returns hour:minute:second
one hour later as it should.
Does it mean that the only way around it is to keep transition
dates for Daylight Saving Time for all years and have my code
make the adjustments depending on the old day and the current
day? Is there any utility to do that or any better way?
Check the value of tm_isdst. If the value is positive then DST is
in effect, if it's zero then DST is not in effect. If that value
is negative then that information is not available. Unless you
get a negative value you should have correct DST information
provided that your system has up to date time zone information.
It may not be your case but time_t range and precision are
implementation defined and they can actually be different between
different versions of the same compiler.
Can you give me some timestamps, the tm values you get and the tm
values you expect?
--
Ioan - Ciprian Tandau
tandau _at_ freeshell _dot_ org (hope it's not too late)
(... and that it still works...)
.
- Follow-Ups:
- Re: How to handle localtime() on old timestamps?
- From: maruk2@xxxxxxxxxxx
- Re: How to handle localtime() on old timestamps?
- References:
- How to handle localtime() on old timestamps?
- From: maruk2@xxxxxxxxxxx
- How to handle localtime() on old timestamps?
- Prev by Date: Re: How to handle localtime() on old timestamps?
- Next by Date: salut
- Previous by thread: Re: How to handle localtime() on old timestamps?
- Next by thread: Re: How to handle localtime() on old timestamps?
- Index(es):
Relevant Pages
|
|