April 25th, 2009, 04:38 PM
Time have passed.
Hey there, I have asked this somewhere else but I will be asking here too:
How do I know how much time have passed since a time object?
I want a way to know how many seconds have passed?
$time = Time.now
# I leave, and come back after 3 hours.
# Now I want a method to return how much time have passed...
# It should return "10800", the number of seconds passed.
April 25th, 2009, 08:33 PM
You can use a difference of clock values to determine the time your code ran:
Hope that helps.
timeStart = Time.now
# Run your code here....
timeStop = Time.now
puts (timeStart - timeStop) + " seconds have passed."
April 26th, 2009, 04:19 PM
Of course, you would need to take the negative of that
Originally Posted by codergeek42
would do the trick.
timeStop - timeStart
Comments on this post
True happiness is not getting what you want, it's wanting what you've already got.