Project

General

Profile

Actions

Bug #16445

closed

Time#inspect shows a fractional number

Added by znz (Kazuhiro NISHIYAMA) about 4 years ago. Updated about 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0dev (2019-12-22T14:17:39Z master d339de9d1a) [x86_64-darwin18]
[ruby-core:96415]

Description

Time#inspect shows a fractional number.

irb(main):001:0> Time.at(0.5)
=> 1970-01-01 09:00:00.5 +0900
irb(main):002:0> Time.at(0.1)
=> 1970-01-01 09:00:00 3602879701896397/36028797018963968 +0900

Is this intentional?


Related issues 1 (0 open1 closed)

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

Updated by matz (Yukihiro Matsumoto) about 4 years ago

  • Status changed from Open to Closed

This is intentional. There was no way to distinguish Time objects that differ in a fraction of a second.
The behavior of Time#to_s kept unchanged for compatibility.

Matz.

Actions #2

Updated by znz (Kazuhiro NISHIYAMA) about 4 years ago

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

Also available in: Atom PDF

Like0
Like0Like0