method

to_f

v1_9_1_378 - Show latest stable - Class: Time
to_f()
public

Returns the value of time as a floating point number of seconds since the Epoch.

t = Time.now
"%10.5f" % t.to_f   #=> "1049896564.13654"
t.to_i              #=> 1049896564

Note that IEEE 754 double is not accurate enough to represent nanoseconds from the Epoch.