From: nobu@... Date: 2014-06-18T04:40:45+00:00 Subject: [ruby-core:63212] [ruby-trunk - Bug #9951] [Assigned] DateTime.strftime and Time.strftime differ in how they treat "%L" Issue #9951 has been updated by Nobuyoshi Nakada. Description updated Status changed from Open to Assigned Assignee set to Akira Tanaka `DateTime` seems to round the fraction of second in nanoseconds at initialization. ---------------------------------------- Bug #9951: DateTime.strftime and Time.strftime differ in how they treat "%L" https://bugs.ruby-lang.org/issues/9951#change-47260 * Author: David Chelimsky * Status: Assigned * Priority: Normal * Assignee: Akira Tanaka * Category: core * Target version: * ruby -v: 1.9.3 - 2.1.1 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- ~~~ruby DateTime.new(2014,1,2,3,4,5.678).strftime("%L") # => "678" Time.new(2014,1,2,3,4,5.678).strftime("%L") # => "677" ~~~ I think these should both produce "678", but at the very least they should produce the same number so users don't have to special case one or the other. I realize there is floating point math under the hood here, but that's an implementation detail I don't think users should care about in this case. -- https://bugs.ruby-lang.org/