Ruby 2.7 added sub seconds
to Time#inspect
and separated it from Time#to_s
.
Rails also added sub seconds to
ActiveSupport::TimeWithZone#inspect
.
This is particularly helpful when multiple time objects are created in a short interval. For e.g., when executing imports in parallel, or when we need to assert time differences in our test cases.
Before
After
Summary
As seen above the nsec
part is not ignored anymore when we use inspect.
This is useful for finer comparisons, assertions and usage with time across databases and systems.