This year my birthday fell on the most notorious date of history…Friday the 13th.I was curious to know about the significance and reason for why this date brings horror in mind.I googled for it and found many thing about it.
But the most striking moment of my life was when this date hit me too. I am not a superstitious kinda person but this incident made me to think again. The incident goes like…
I was on verge of finishing a project.But as usually clients demand for a last minute changes my client asked to change a default value of a date in dateselect_tag to year 2100.I didnt mind as it was a kids play.
I made changes in code
@default_date = Time.utc(2100,"jan",1,0,0,0)
It looked fine but when i run the application again it collapsed with
ArgumentError in Admin/account#new
time out of range
I coudnt figure out what the problem was.den i changed the year to 2035 it worked fine.I tried different combinations and found it dont work for year greater then 2038 but dont know the reason.
Finally i look up to google for help.And as google usually do Google helped me hare too.And now what i found out was the most amazing thing in my life.see what i found in google .
If you follow the link you will know what my problem was. You see ruby is also 32-bit system so its affected too. The problem in short is …
" 32-bit signed integer, such as a time_t, set to its maximum value of 2 147 483 647 and then incremented by 1, will become -2 147 483 648. Note that "-" sign at the beginning of this large number. A time_t value of -2 147 483 648 would represent December 13, 1901 at 8:45:52 PM GMT. "
The point that took me aback was December 13, 1901 at 8:45:52 PM GMT is going to fall on Friday .So you see i got another example of Friday the 13th horror among not at all superstitious IT community. Well this was actually an overstatement as nothing can horrify IT community this bug is easily fixable and by the year 2038 no one knows where would these fast growing techs. be taking us. I m proud to be a member of this community