Re: the Y2K38 BUG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 6, 2008 at 11:56 PM, Paul Scott <pscott@xxxxxxxxx> wrote:

>
> On Tue, 2008-05-06 at 23:50 -0600, Nathan Nobbe wrote:
> > true-that ;)
> > anyway, the DateTime class is implemented as a 64-bit unsigned (i think)
> > value.  so if you use it you should be good to go.
> >
> > php > echo date_create('2040-10-24')->format('M-d-Y');
> > Oct-24-2040
> >
>
> a 64bit unsigned int is best, but that would only work properly on 64bit
> arch. For 32bit users, making it unsigned is the best option for now,
> and I suppose that by 2038 there will be another option.


i put "i think" only because im not 100% on the implementation, though i
know it has something to do w/ 64-bits; and it does seem to support a
massive range of dates on a 32-bit system.  and also, there is good reason
to use it, if for example you have dates that are prior to dec 13, 1901.
the standard date() stuff chokes on anything earlier than that.  and even
now, i have dealt with applications doing date arithmetic that spilled over
2038, breaking existing logic.

php > echo `uname -p` . PHP_EOL;
AMD Athlon(tm) XP 1500+

php > echo date('M-d-Y', -5555500000);
Dec-13-1901
php > echo date_create('@-5555500000')->format('M-d-Y');
Dec-14-1793


> As far as I am concerned, this discussion is a discussion for the sake
> of discussion. If I am still using the same apps that I use today in
> 2038, I will officially rethink my usefulness as a human being :)


as far as im concerned ive committed to using DateTime ever since i learned
of its superior internal implementation.  that way i dont have to deal with
silly bounds related limitations in my date time calcs, ever (practically
speaking) :D

except of course those introduced by umm, human error ;)

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux