Section 7.2. Working with Specific Times (Post-epoch)


7.1. Determining the Current Time

The most fundamental problem in time/date manipulation is to answer the question: What is the time and date right now? In Ruby, when we create a Time object with no parameters, it is set to the current date and time.

t0 = Time.new


Time.now is a synonym:

t0 = Time.now


Note that the resolution of system clocks varies from one architecture to another. It may include microseconds in which case two Time objects created in succession may actually record different times.




The Ruby Way(c) Solutions and Techniques in Ruby Programming
The Ruby Way, Second Edition: Solutions and Techniques in Ruby Programming (2nd Edition)
ISBN: 0672328844
EAN: 2147483647
Year: 2004
Pages: 269
Authors: Hal Fulton

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net