Definitions of date arithmetic
eggert at twinsun.com
Sat Oct 10 00:53:16 UTC 1998
Date: 9 Oct 1998 23:17:26 -0000
From: "D. J. Bernstein" <djb at cr.yp.to>
What is 1 month before 31 March?
I see two answers to that question:
* ``It's an error to ask that question.'' I.e. the mktime replacement
would report an error if asked that question.
* 29 February if it's a leap lear, 28 February otherwise.
There are reasonable arguments for either answer. Perhaps the
standard should leave it open.
A closely related question is ``What is 1 minute before 23:59:60?''.
Here's a good one: ``What is 1 month before 1 February 1995 in
Kiritimati?''. There was no 1 January 1995 in Kiritimati; they
skipped a day by moving the clocks ahead 24 hours. Similar issues
arise when asking about times that occur within smaller, more typical
UTC offset changes. A number of obscure questions arise here, and I'm
not sure it's worth standardizing all the answers.
More information about the tz