Subject: Re: mktime(3) fails to convert a time in the "spring forward gap"
To: Bill Studenmund <wrstuden@netbsd.org>
From: Andrew Brown <atatat@atatdot.net>
List: tech-userlevel
Date: 10/09/2002 16:02:35
>If you want an hour after a given time, isn't it better to get a time_t
>and do the math on it?
almost. suppose you wish to add a day. simply adding 86400 won't get
the right answer either, because when you skip an hour due to daylight
savings, a day is only 82800 seconds long.
imho, any application that wants to muck with time like this *NEEDS*
to know that daylight savings time might become an issue and deal with
it accordingly. it *CAN'T* simply pretend that wall clock time is
continuous (if it insists, make it do the work in utc and perhaps
convert to the local time zone later). whether any two applications
do this the same way is up to the application.
i've done this a fair amount...it can be quite annoying and tedious.
subsequently explaining the difficulties to a layman can be nigh unto
impossible.
--
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org * "ah! i see you have the internet
twofsonet@graffiti.com (Andrew Brown) that goes *ping*!"
werdna@squooshy.com * "information is power -- share the wealth."