Re: [PATCH v3 1/2] Add function to convert between calendar timeand broken-down time for universal use

From: Pavel Machek
Date: Mon Jul 27 2009 - 18:44:48 EST


On Sat 2009-07-25 14:42:06, OGAWA Hirofumi wrote:
> Zhaolei <zhaolei@xxxxxxxxxxxxxx> writes:
>
> > +/*
> > + * Similar to the struct tm in userspace <time.h>, but it needs to be here so
> > + * that the kernel source is self contained.
> > + */
> > +struct tm {
> > + /*
> > + * the number of seconds after the minute, normally in the range
> > + * 0 to 59, but can be up to 60 to allow for leap seconds
> > + */
> > + int tm_sec;
> > + /* the number of minutes after the hour, in the range 0 to 59*/
> > + int tm_min;
> > + /* the number of hours past midnight, in the range 0 to 23 */
> > + int tm_hour;
> > + /* the day of the month, in the range 1 to 31 */
> > + int tm_mday;
> > + /* the number of months since January, in the range 0 to 11 */
> > + int tm_mon;
> > + /* the number of years since 1900 */
> > + int tm_year;
>
> Why isn't this "long"? "int" can overflow.

Overflow? Year?

I'm not sure how far ahead you are looking, but support for year
2000000000 (2e9) seems perfectly okay to me. (Our friendly star here,
sun, is going to die at cca year 5e9, for comparison. )

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/