[ruby-core:77997] [Ruby trunk Feature#10544][Rejected] Time#to_i(:millisecond)
From:
akr@...
Date:
2016-11-05 16:23:56 UTC
List:
ruby-core #77997
Issue #10544 has been updated by Akira Tanaka. Status changed from Open to Rejected We have Process.clock_gettime since Ruby 2.1. ``` % ruby -e 'p Process.clock_gettime(Process::CLOCK_REALTIME, :millisecond)' 1478362786099 ``` This can be used as Time.now.to_i(:millisecond) which is shown in this issue. If it is not enough, please reopen. ---------------------------------------- Feature #10544: Time#to_i(:millisecond) https://bugs.ruby-lang.org/issues/10544#change-61334 * Author: Masaki Matsushita * Status: Rejected * Priority: Normal * Assignee: ---------------------------------------- Currently, we have to take an indirect way to get unix_time in milliseconds. ~~~ruby time = Time.now milliseconds = (time.to_i * 1000) + (time.usec / 1000.0).round ~~~ I think it would be convenient if `Time#to_i` accepts unit parameter like following. ~~~ruby time = Time.now milliseconds = time.to_i(:millisecond) ~~~ ---Files-------------------------------- patch.diff (2.71 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>