note 17283 deleted from function.strtotime by jimw

From: Date: Fri, 14 Dec 2001 20:58:26 +0000
Subject: note 17283 deleted from function.strtotime by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-22807@lists.php.net to get a copy of this message
it seems like strtotime can "count" up to 2^31 seconds, AND (counting backwards from any date below 2038), if the difference between 1jan1970 and the "str" (like "-16 years") remains within 2^31 bits from the start time (given to strtotime), then the "out of bounds" checking functions correctly (that is, strototime("-16years",mktime(1jan1970)) returns a negative value, as the docs say -- note, however, the docs say fault returns only "-1" -- i've not found this true) HOWEVER, go further, say, -67years from 1970, and the number of seconds backwards exceed 2^31 and strtotime "wraps around" from 2038, counting down. same is true for reverse. count up from any date, strtotime will return -negative (fault) value unless the supplied offset exceeds 2^31 seconds, in which case strtotime wraps around from 1970 upwards. i haven't tried passing exact offset of exact number of seconds (accounting for GMT offset), but i wonder if passing just the right offset from just the right time (like "-2^31 seconds" from 1jan1970, or "+2^31 seconds" from 18feb2038 [or whatever the date is of 2^31 seconds after 1jan1970]) might force strotime into a nonexiting loop?

« previous php.notes (#22807) next »