On Mon, Mar 24, 2014 at 11:03:42PM +0100, René Scharfe wrote:
> >If the result is all-zeroes, can we check for that case instead? I
> >suppose that will eventually create a "trap" at midnight on January 1st
> >of the year 0 (though I am not sure such a date is even meaningful,
> >given the history of our calendars).
>
> Makes sense. That would be "Sun Jan 0 00:00:00 1900", however -- days are
> 1-based and years 1900-based in struct tm.
Oh right, I was stupidly forgetting about being 1900-based.
> Since a zeroth day is invalid, would this suffice:
>
> if (!tm || !tm->tm_mday) {
>
> (Yes, I'm lazy. :)
That looks perfect (and I like that it is quick to check, too, since
this case should be extremely rare).
-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html