[ruby-core:96417] [Ruby master Bug#16445] Time#inspect shows a fractional number

[email protected]
Newsgroups gmane.comp.lang.ruby.core
Message-ID <redmine.journal-83341.20191223071519.8a3c251ef9d8e722@ruby-lang.org>
Issue #16445 has been updated by matz (Yukihiro Matsumoto).

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.



  

----------------------------------------
Bug #16445: Time#inspect shows a fractional number
https://bugs.ruby-lang.org/issues/16445#change-83341

* Author: znz (Kazuhiro NISHIYAMA)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.7.0dev (2019-12-22T14:17:39Z master d339de9d1a) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
`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?



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

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.