Feature #15958

Time#inspect with frac

Added by naruse (Yui NARUSE) over 1 year ago. Updated over 1 year ago.

Target version:


When Matz changed Time#to_s format in 2006, frac part of Time string is dropped because it is considered not useful.

But recently we encounters some troubles the comparison of Time objects whose frac parts are different.

For example a is original object and b is once stored in RDB (and dropped the frac part).
Or there're multiple time objects which are generated in a single HTTP request.
Of course they are different and assert_equal will be failed but inspect doesn't show the frac part.

Related issues

Related to Ruby master - Feature #16470: Issue with nanoseconds in Time#inspectClosedmatz (Yukihiro Matsumoto)Actions

Updated by matz (Yukihiro Matsumoto) over 1 year ago

I am not entirely against the idea, just worrying compatibility.
Should we experiment Time#inspect with fraction output?



Updated by naruse (Yui NARUSE) over 1 year ago

  • Status changed from Assigned to Closed

Applied in changeset git|5208c431bef3240eb251f5da23723b324431a98e.

Separate Time#inspect from to_s and show subsec [Feature #15958]


Updated by Eregon (Benoit Daloze) 9 months ago

  • Related to Feature #16470: Issue with nanoseconds in Time#inspect added

Also available in: Atom PDF