Project

General

Profile

Actions

Bug #2952

closed

Time.strftime format %N

Added by rpenney (Russell Penney) about 14 years ago. Updated about 13 years ago.

Status:
Rejected
Assignee:
-
ruby -v:
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]
[ruby-core:28602]

Description

=begin
There seems to be some rouding errors with the %N formatter for Time->strftime
t1 = 1236922275.8516
t2 = Time.at(t1)

puts t1
puts t2.to_f
puts t1 == t2.to_f
puts t2.strftime("%s.%6N")

prints
1236922275.8516
1236922275.8516
true
1236922275.851599

The last line is wrong. I would expect it would print "1236922275.851600".
If I use %4N I get 1236922275.8515 which is also wrong
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0