From: "headius (Charles Nutter)" Date: 2013-03-20T10:31:04+09:00 Subject: [ruby-core:53565] [CommonRuby - Feature #8096] introduce Time.current_timestamp Issue #8096 has been updated by headius (Charles Nutter). naruse (Yui NARUSE) wrote: > What class is it? > If Float, it introduces extra error. > If Rational, I feel Time is better. It is a Fixnum: ext-jruby-local ~/projects/jruby $ jruby -e "def Time.timestamp; java.lang.System.nano_time / 1000; end; loop { p Time.timestamp; sleep 1.5 }" 1363742953730794 1363742955254423 1363742956757052 1363742958259167 1363742959762959 1363742961264507 1363742962765680 1363742964267276 1363742965769053 1363742967270540 1363742968773957 1363742970275904 1363742971777002 1363742973279089 ... I think the goal here is to reduce the amount of allocation needed to get a simple integer timestamp. ---------------------------------------- Feature #8096: introduce Time.current_timestamp https://bugs.ruby-lang.org/issues/8096#change-37752 Author: vipulnsward (Vipul Amler) Status: Feedback Priority: Low Assignee: Category: Target version: =begin A lot of scenarios and applications require the use of (({Time.now.to_i})) which is used as current_timestamp in systems. The introduction of (({Time.current_timestamp})) {or something with similar with different name} would provide implicit integer timestamp instead of going from (({Time.now})) -> time_object -> to_i -> integer timestamp value So instead of Time.now.to_i # Outputs => 1363274618 one could use Time.current_timestamp # Outputs => 1363274618 =end -- http://bugs.ruby-lang.org/