[#64517] Fw: Re: Ruby and Rails to become Apache Incubator Project — Tetsuya Kitahata <[email protected]>

What do you think? >> Ruby developers

13 messages 2014/08/23

[#64615] [ruby-trunk - Feature #10181] [Open] New method File.openat() — oss-ruby-lang@...

Issue #10181 has been reported by Technorama Ltd..

10 messages 2014/08/28
[#64616] Re: [ruby-trunk - Feature #10181] [Open] New method File.openat() — Eric Wong <normalperson@...> 2014/08/28

I like this feature.

[#64671] Fwd: [ruby-changes:35240] normal:r47322 (trunk): symbol.c (rb_sym2id): do not return garbage object — SASADA Koichi <ko1@...>

Why this fix solve your problem?

9 messages 2014/08/30
[#64672] Re: Fwd: [ruby-changes:35240] normal:r47322 (trunk): symbol.c (rb_sym2id): do not return garbage object — SASADA Koichi <ko1@...> 2014/08/30

(2014/08/30 8:50), SASADA Koichi wrote:

[ruby-core:64560] [ruby-trunk - Bug #10135] Time.at is inaccurate

From: akr@...
Date: 2014-08-26 06:19:32 UTC
List: ruby-core #64560
Issue #10135 has been updated by Akira Tanaka.


Tsuyoshi Sawada wrote:
> 
> the float stored by `Time.at` is not the same float:
> 
> ~~~ruby
>     Time.at(1381089302.195).to_f
>     #=> 1381089302.1949997
> ~~~

This is another story.

Time#to_f is not accurate.

There are workaround, though:

~~~ruby
Time.at(1381089302.195).to_r.to_f
#=> 1381089302.195
~~~


----------------------------------------
Bug #10135: Time.at is inaccurate
https://bugs.ruby-lang.org/issues/10135#change-48487

* Author: John Smart
* Status: Rejected
* Priority: Low
* Assignee: Akira Tanaka
* Category: 
* Target version: current: 2.2.0
* ruby -v: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
I believe I have found an issue with Time.at.  Many runtimes and DBs use milliseconds since epoch for recording time.  Currently, the only way to generate a Time in ruby with milliseconds is:

~~~
Time.at(milliseconds / 1000.0)
~~~

However, this is inaccurate:

~~~
> Time.at(1381089302195 / 1000.0).to_f
=> 1381089302.1949997
> Time.at(1381089302195 / 1000.0).strftime('%3N')
=> "194"
~~~

This doesn't make much sense because you would expect:

~~~
> 1381089302195 / 1000.0
=> 1381089302.195
> (1381089302195 / 1000.0).to_f
=> 1381089302.195
~~~

It seems that somewhere in the MRI, someone is using floating-point math to represent a Time.

Is there any other way (workaround) to construct Time with millisecond accuracy?




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

In This Thread

Prev Next