nsec

time.nsec â int
Instance Public methods

Returns 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 digits of to_f and nsec are different because IEEE 754 double is not accurate enough to represent the exact number of nanoseconds since the Epoch.

The more accurate value is returned by nsec.

doc_ruby_on_rails
2015-05-17 20:41:01
Comments
Leave a Comment

Please login to continue.