Definitions of date arithmetic
D. J. Bernstein
djb at cr.yp.to
Sun Oct 11 01:32:39 UTC 1998
Paul Eggert writes:
> The same as 1 month before 31 March.
Okay. You can easily implement that on top of something like mktime():
void month_add(struct caldate *out,struct caldate *in,int m)
{
*out = *in;
out->month += m;
normalize(out);
if (out->day != in->day) {
out->day = FIRST - 1;
normalize(out);
}
}
This example certainly doesn't convince me that mktime()'s handling of
invalid dates is a bad thing.
---Dan
1000 recipients, 28.8 modem, 10 seconds. http://pobox.com/~djb/qmail/mini.html
More information about the tz
mailing list