method
nsec
v1_9_3_392 -
Show latest stable
- Class:
Time
nsec()public
Returns just the number of nanoseconds for time.
t = Time.now #=> 2007-11-17 15:18:03 +0900 "%10.9f" % t.to_f #=> "1195280283.536151409" t.nsec #=> 536151406
The lowest digit of to_f and nsec is different because IEEE 754 double is not accurate enough to represent nanoseconds from the Epoch. The accurate value is returned by nsec.