Out of range on Dates beyond 2038/01/19

F

Fernando Guillen

Hi people,

I'd just found this issue trying to parse a date:
ArgumentError: time out of range
from (irb):33:in `local'
from (irb):33

It looks like Time class is not available to manage dates bigger than
2038/01/19.

I have found this conversation:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/190564

There they say that is a problem of 32bits processors because the number
of seconds from 1970 don't fix into 32 bits.

Some one of you have already fight with this issue?

Is there any solution?

Thanks
f.
 
J

Josef 'Jupp' Schugt

ArgumentError: time out of range
from (irb):33:in `local'
from (irb):33

It looks like Time class is not available to manage dates bigger than
2038/01/19.

Being a user of 64 bit operating systems for over a decade now (initially on Digital Unix), I sometimes find it surprising that so many people are still using 32 bit operating systems. On my 64 bit Fedora there is no issue with that date:
=> Wed Jan 20 00:00:00 0100 2038

$ uname -a
Linux pen2.homeunix.net 2.6.27.5-41.fc9.x86_64 #1 SMP Thu Nov 13 20:29:07 EST 2008 x86_64 x86_64 x86_64 GNU/Linux

Josef 'Jupp' Schugt
 
K

Kyle Schmitt

Hi people,

I'd just found this issue trying to parse a date:

ArgumentError: time out of range
from (irb):33:in `local'
from (irb):33

It looks like Time class is not available to manage dates bigger than
2038/01/19.

I have found this conversation:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/190564
It's not a ruby bug per say, it's a general problem that 32bit systems
have with unix time. Unix time is stored in seconds since the epoch,
in a native unsigned integer, which on most systems is 32 bits. On
64bit systems, this obviously isn't a problem.

See the link for details.

http://en.wikipedia.org/wiki/Year_2038_problem
 
K

Kyle Schmitt

Err, I should have mentioned, many UNIX and UNIX like systems have
switched to using a 64bit integer, even some running on 32 bit
processors I believe (but don't quote me on that).
 
F

Fernando Guillen

Thank you people for the information.

So the solution is to upgrade hardware to 64bits :)

I am using Mac OS X 10.5.5

$ uname -a
Darwin macbook-de-fernando-guillen.local 9.5.0 Darwin Kernel Version
9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386
i386

Thanks again

f.
 
P

Peña, Botp

RnJvbTogRmVybmFuZG8gR3VpbGxlbiBbbWFpbHRvOmZndWlsbGVuLm1haWxAZ21haWwuY29tXSAN
CiMgU28gdGhlIHNvbHV0aW9uIGlzIHRvIHVwZ3JhZGUgaGFyZHdhcmUgdG8gNjRiaXRzIDopDQoN
CnlvdSBjYW4gdXNlIGRhdGUuIHZpcnR1YWxseSBubyBsaW1pdC4NCg0KPiByZXF1aXJlICJkYXRl
Ig0KPT4gdHJ1ZQ0KPiBEYXRlVGltZS5uZXcoMjAzOCwgMSwgMjApLnRvX3MNCj0+ICIyMDM4LTAx
LTIwVDAwOjAwOjAwKzAwOjAwIg0KDQo=
 
F

Fernando Guillen

Wich is the gem I have to install?

$ gem search -r date | wc -l
42

Thanks

f.
 
S

Siep Korteling

Fernando said:
Wich is the gem I have to install?

$ gem search -r date | wc -l
42

Thanks

f.

Date is in the standard library; so no gem to install.

hth,

Siep
 
F

Fernando Guillen

Siep said:
Date is in the standard library; so no gem to install.

Sorry.. thx.. I was confused because:
=> false

It works:
=> "8888-12-12T00:00:00+00:00"

Thanks

f.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,732
Latest member
ArronPalin

Latest Threads

Top