Issue #15322 has been reported by okkez (okkez _).

----------------------------------------
Bug #15322: Time.parse does not support %3N, %6N, %9N
https://bugs.ruby-lang.org/issues/15322

* Author: okkez (okkez _)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
~~~
Time.parse("2018-11-20 17:11:22.123", "%Y-%m-%d %H:%M:%S.%3N")
# => raise ArgumentError: invalid strptime format - `%Y-%m-%d %H:%M:%S.%3N'
Time.parse("2018-11-20 17:11:22.123456", "%Y-%m-%d %H:%M:%S.%6N")
# => raise ArgumentError: invalid strptime format - `%Y-%m-%d %H:%M:%S.%6N'
Time.parse("2018-11-20 17:11:22.123456789", "%Y-%m-%d %H:%M:%S.%9N")
# => raise ArgumentError: invalid strptime format - `%Y-%m-%d %H:%M:%S.%9N'
~~~

But RDoc says that (https://docs.ruby-lang.org/en/2.5.0/Time.html#method-c-strptime):

~~~
%N
Fractional seconds digits, default is 9 digits (nanosecond)

  %3N
  millisecond (3 digits)

  %6N
  microsecond (6 digits)

  %9N
  nanosecond (9 digits)
~~~

`%N` works fine for this purpose.
I think we can remove %3N, %6N, and %9N from the document.

In fact, Fluentd users confuse when they read [the document](https://docs.ruby-lang.org/en/2.5.0/Time.html#method-c-strptime) to configure Fluentd's parameter.


See also #11220

---Files--------------------------------
fix-time-parse-format-doc.patch (572 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>