time(); after 2038?
Asked Answered
H

2

7

Will the php function time(); be functional after the year 2038?

Honorarium answered 28/4, 2011 at 23:25 Comment(6)
will there be internet in 2038th ?Script
If I knew how the world would work in 2038 I wouldn't be here answering questions...Furriery
Depends if you're running a 32-bit or 64-bit version of PHPAllmon
@Jon: You made me giggle, will sticks and stones work in 2038?Surroundings
lol @alix lol maybe you are right i am worrying about it too earlyHonorarium
@PeeHaa: Tell me the time so that I can make popcorns.Surroundings
S
9

Of course, when the time comes PHP 42.1.3 will natively support 64-bit integers.

Surroundings answered 28/4, 2011 at 23:30 Comment(3)
php version 42? PHP born about 10 years ago and now it's version 5 :) i don't think in 20 years it will reach version 42Honorarium
@yes123 Whatever version we have by then, I do know that PHP6 will still be on the horizon somewhere.Barmecide
i am young but i don't believe i will see php 6 while alive lolHonorarium
Y
0

Yes, it should be. But let me run that code in my VirtuaBox and changed the date as well in there.

you know it could be fun to try it out :)

Yeh answered 28/4, 2011 at 23:30 Comment(10)
You'll probably get a signed (negative) integer. Let me know how it goes! ;)Surroundings
also I'm imagining that by that time, there will be a better language, new language or it might not be even called PHP anymoreYeh
What happened, did the world change?Mattison
@fedmich: No, RoR will be gone and PHP will still rule the world! NURV! :PSurroundings
@Yeh If PHP's name changes, it'll probably change to "PHP", where the first P stands for "PHP", of which the first P stands for "PHP". Infinite recursion will crash the Internet.Barmecide
Wait a moment. I Don't think you have to run a virtualbox to change the date in your osHonorarium
I just execute it and I got -2138856280 ... looks like our apps will break then :(Yeh
@yes123 I couldnt change the date of my computer/server as there's too many apps going on and processing some stuff; so I could only execute codes like this via virtuabox.Yeh
Lol... all I could say is that PHP Rocks!Yeh
You can fake the system time using libfaketime. On Linux x86_64 with PHP 5.4.13, the value returned is not negative. LD_PRELOAD=src/libfaketime.so.1 FAKETIME="31337-12-12 00:00:00" php -r 'echo time(),"\n";' gives 48541007779. Oh, but date seems to have issues interpreting 31337 though (3508-03-16). On the lucky side, 4242 works!Weisler

© 2022 - 2024 — McMap. All rights reserved.