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
t.to_i
Note that IEEE 754 double is not accurate enough to represent nanoseconds
from the Epoch.
Show source
static VALUE
time_to_f(VALUE time)
{
struct time_object *tobj;
GetTimeval(time, tobj);
return DBL2NUM((double)tobj->ts.tv_sec+(double)tobj->ts.tv_nsec/1e9);
}