Hello, please sign in or register
You are here: Home

Y-2038 bug

The not so well known Y2038 bug is looming. And threatens unix timestamps.Such as...

mysql

mysql/> SELECT UNIX_TIMESTAMP('2038-01-01')

Will return "0"

PHP

<?php
print mktime(3,14,8,1,19,2038); //bool(false)
?>

Will return nothing... make it a second earlier and it'll return 2,147,483,648

So why has this happened?

Timestamps are stored in four bytes so the maximum number of values is over 4.29 billion. For some reason it seems one of the bits is not used (perhaps signed +-) and our maximum is half of the 4.29 billion. Which can be expressed by the equation

pow(2,(8*4)-1) = 2,147,483,648

... this is the number of possible values. Since zero is a value the maximum value is thus 2,147,483,647

This range of numbers is used to give a value of the number of seconds since the epoch of 1970-01-01... so everyone knew the series would be obsolete by 2038 - unless you add another byte of course.

 

Comments

hxy1220
hxy1220 ray ban wayfarer rolex watches,rolex watches,swiss watches,watches for men,watches for women,omega watches,replica ...
Created 20/12/16
hxy1.22
hxy1.22 ugg outlet burberry outlet louis vuitton
Created 22/01/17
Title*
Comment

Prove you are not a robot

To prove you are not a robot, please type in the six character code you see in the picture below
Security confirmation codeI can't see this!
Contact
Name*
Email never shown*
Home Page

Author

Andrew Dodson
Since:Feb 2007

Comment | flag

Categories

Bookmark and Share