views:

281

answers:

2

Times farthest in the past and farthest in the future that can be represented?

Is it absolute moments in time, or distance in time from the present moment?

I couldn't find it in the docs for the Time class.

Does it depend on the system? If so, how can I access it in my code?

UPDATE

After some experimentation, I found that it's from about 108 years in the past to about 29 years in the future. Still wondering if it's system dependent.

+2  A: 

"Time is stored internally as the number of seconds and microseconds since the epoch, January 1, 1970 00:00 UTC. On some operating systems, this offset is allowed to be negative."

So clearly its an abosolute time not relative to now

Sounds like there is a "C" time implementation under cover (integers can be signed or unsigned depending on OS / processor / compiler) : it means the bounds are system dependent.

But if you need to handle dates that are that long ago / far in the future, I guess you won't really need the "time of day" part and can use a Date !?

siukurnin
+2  A: 

DateTime (in the Date library, included with ruby) goes back to 1 January 4713 BCE and farther into the future than you are likely to need.

MarkusQ