Subject: Re: mktime(3) fails to convert a time in the "spring forward gap"
From: Ignatios Souvatzis <firstname.lastname@example.org>
Date: 10/17/2002 14:17:40
Content-Type: text/plain; charset=us-ascii
On Wed, Oct 09, 2002 at 04:02:35PM -0400, Andrew Brown wrote:
> >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.
Those are two different days.
If you want to skip a real day, just do the time_t arithmetic.
If you want to skip a _calendar_ day, you have a problem ---=20
There _is_ no calendar date corresponding to day foo, 02:30:00 + one calend=
day, in some timezones, for some value of foo. You have to decide what you
really want to compute in this case (e.g., there are special train
schedules...) If you don't want to consider timezones with DST, just use the
-----BEGIN PGP SIGNATURE-----
-----END PGP SIGNATURE-----