class Time doesn't pass year 2038?

J

Jean-Baptiste

Is there another class to process dates after 2038? (and before 1970)

Thanks.
 
J

Jean-Baptiste

Jean-Baptiste said:
Is there another class to process dates after 2038? (and before 1970)

Thanks.

Sorry.
I just found the Date class.

It looks much slower than Time class.

JB
 
J

Josef 'Jupp' SCHUGT

Hi!

* Jean-Baptiste:
Is there another class to process dates after 2038? (and before
1970)

Just to point that out: We are very close to the middle of epoch
(saturday, don't know the precise time by heart).

Josef 'Jupp' SCHUGT
 
S

Shashank Date

Mark J. Reed said:
Saturday, 2004 January 10 13:37:04 UTC

Please allow my ignorance: what is this all about? I thought epoch was just
a unit of time.
Did not know that it had a middle. :)

--- shanko
 
H

Hal Fulton

Shashank said:
Please allow my ignorance: what is this all about? I thought epoch was just
a unit of time.
Did not know that it had a middle. :)

In general that is true. :)

They are talking about Unix time, which has its zero point
at Jan 1, 1970 midnight UTC. In a fixed number of bits
(umm, 32?), the number of seconds will "overflow" in the
year 2038.

<joke type="y2k">Then, of course, civilization will plunge
into chaos. Elevators won't work, planes will fall out of
the sky, and dogs and cats will sleep together.</joke>

Strangely the math isn't making sense to me at the moment.

A billion seconds should be very roughly thirty years.
That's 10**9 or roughly 2**27. The epoch is 68 years long.
Surely we're not storing it in 28 bits. Someone show me
where I'm being stupid.



Hal
 
H

Hal Fulton

Hal said:
Strangely the math isn't making sense to me at the moment.

A billion seconds should be very roughly thirty years.
That's 10**9 or roughly 2**27. The epoch is 68 years long.
Surely we're not storing it in 28 bits. Someone show me
where I'm being stupid.

Sorry to reply to myself. Of course, a billion ~= 2**30
((2**10)**3).

But then another factor of two should be sufficient to store
the date (31 bits).

The answer apparently is that Unix time with the sign bit
(was that always there?) can go backwards ~68 years also.
So in theory we should be able to represent dates roughly
back to 1902. And checking in irb, I see that this works.
Hmm, did I get this wrong in TRW ch 2?


Hal
 
D

Daniel Carrera

Saturday, 2004 January 10 13:37:04 UTC

:)


Could someone tell me an elegant way to figure that out?
I'm trying to figure out how the Time function works. I'm looking at the
ri documentation, but I haven't figured out what it expects for input.

Is UTC the same as Greenwich Mean Time?

Cheers,
 
D

Daniel Carrera

Could someone tell me an elegant way to figure that out?
I'm trying to figure out how the Time function works. I'm looking at the
ri documentation, but I haven't figured out what it expects for input.

Sorry to reply to my own post, but by trial and error I think I found it.
Time.at takes the number of seconds since the epoch, right?

So, to figure out the mid point of the Epoch I simply use:
=> Sat Jan 10 13:37:04 UTC 2004

Is UTC the same as Greenwich Mean Time?

I guess it must be. But Time doesn't seem to have a 'gmt' method.
 
D

Daniel Carrera

Not only does it feed my growing preference for Ruby over Perl, it's
even less typing. :)

I do love Ruby. =)
Short answer: yes. Long answer: "no, but . . . " :)

Thanks.
UTC rocks. The other links were very interesting too.

I am definitely going to celebrate the 2**30th second after the epoch.
It's not often that this happens. The last 2**30 seconds have been great
and eventful for Unix, and now Linux is positioned to carry on this proud
tradition. May the next 2**30 seconds be prosperous ones.

Happy epoch to everyone!

Cheers,
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top