subsec

time.subsec รข number
Instance Public methods

Returns the fraction for time.

The return value can be a rational number.

t = Time.now        #=> 2009-03-26 22:33:12 +0900
"%10.9f" % t.to_f   #=> "1238074392.940563917"
t.subsec            #=> (94056401/100000000)

The lowest digits of to_f and subsec are different because IEEE 754 double is not accurate enough to represent the rational number.

The more accurate value is returned by subsec.

doc_ruby_on_rails
2015-05-17 21:22:54
Comments
Leave a Comment

Please login to continue.