[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: y2038 branch



H.Merijn Brand wrote:
>> Merijn, could you put in LOCALTIME_MAX and LOCALTIME_MIN functions similar to
>> GMTIME_MAX and GMTIME_MIN?  Then I can make it use the system functions
>> instead, if applicable.  Thanks.
> 
> I doubt the usefulness of these new two, as for the confusion it might
> cause when the perl built with it is shipped (/me thinks distributions)
> around the world and used in other timezones than the zone perl has
> been built in. And that is runtime!

All we need to know is that it can handle those times and not crap out.  It
doesn't have to test that it gets a particular date for a given time_t.
Although I suppose it might work in one time zone and not work in another,
it's better than nothing.

Although if you DO want to make a test, what I do in the y2038 tests to check
sanity is pick a date in the middle of the month (like Jul 15th, 39829309) and
then test just localtime's month and year.  There's no time zone which is 15
days off from UTC.

And now I wait for the world to prove me wrong.


> gmtime:
> ======================
> Sizeof time_t = 8
>   8:  f0c2ab7c54a97f:   2147485547-12-31 23:59:59
> max:  0x00f0c2ab7c54a97f        67768036191676799
>   8:ffffffe000000001:   4294964910-09-25 08:55:29
> min: -0x0000001fffffffff            -137438953471

So does that say the max is failing at the limit of tm_year (year 2**31-1) and
the min is failing... where?  That min year looks very wrong.

Which makes me notice that my logic for when to use the system localtime is
wrong for negative times.  Whoops.  Fixed.  Now I need to fix localtime's
overflow logic.


> localtime:
> ====================
> TZ = UTC             :        2008-09-14 09:48:35
> Sizeof time_t = 8
>   8:  f0c2ab7c54a97f:   2147485547-12-31 23:59:59
> max:  0x00f0c2ab7c54a97f        67768036191676799
>   8:ffffffe000000001:   4294964910-09-25 08:55:29
> min: -0x0000001fffffffff            -137438953471
> ====================
> TZ = CEST            :        2008-09-14 11:48:39
> Sizeof time_t = 8
>   8:  f0c2ab7c549b6f:   2147485547-12-31 23:59:59
> max:  0x00f0c2ab7c549b6f        67768036191673199
>   8:ffffffe000000001:   4294964910-09-25 09:15:01
> min: -0x0000001fffffffff            -137438953471
> ====================
> TZ = NFT             :        2008-09-14 09:48:05
> Sizeof time_t = 8
>   8:  f0c2ab7c54a97f:   2147485547-12-31 23:59:59
> max:  0x00f0c2ab7c54a97f        67768036191676799
>   8:ffffffe000000001:   4294964910-09-25 08:55:29
> min: -0x0000001fffffffff            -137438953471
> ====================
> TZ = NDT             :        2008-09-14 09:49:31
> Sizeof time_t = 8
>   8:  f0c2ab7c54a97f:   2147485547-12-31 23:59:59
> max:  0x00f0c2ab7c54a97f        67768036191676799
>   8:ffffffe000000001:   4294964910-09-25 08:55:29
> min: -0x0000001fffffffff            -137438953471
> 
> Still want it? (Code is done, just have to add it)



-- 
Just call me 'Moron Sugar'.
	http://www.somethingpositive.net/sp05182002.shtml


Follow-Ups from:
"H.Merijn Brand" <h.m.brand@xs4all.nl>
References to:
Michael G Schwern <schwern@pobox.com>
"H.Merijn Brand" <h.m.brand@xs4all.nl>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]