From: "phluid61 (Matthew Kerwin)" Date: 2013-04-19T08:27:58+09:00 Subject: [ruby-core:54448] [CommonRuby - Feature #8096] introduce Time.current_timestamp Issue #8096 has been updated by phluid61 (Matthew Kerwin). headius (Charles Nutter) wrote: > phluid61 (Matthew Kerwin) wrote: > > My intention was to update the jruby branch to use System.nanoTime for Time.timestamp, which I've finally gotten around to doing, but I see there are still potentially some polytonic (is that even a word?) issues to resolve. Fortunately I've not yet set up my VM to build jruby/java-native gems, or verified my hopefully MRI-and-jruby compatible gemspec, so my java code won't be released into the wild for some time yet. > > I could submit a PR for master that provides the same methods in a JRuby-compatible way, if you'd like. That would be really handy. I've been fiddling a bit more the past couple of days, and I can't quite get it to work properly. I don't know if the failure is in the class file, the jar, or loading it in the test.rb > So we have: > > * Time.timestamp: A ns-precision timestamp based on the fastest, most accurate timer possible on the current platform. Although not guaranteed, this value will be monotonic on most systems. > * Time.something_timestamp: A timestamp representing the number of seconds since the epoch. > > I suggest epoch_timestamp for the latter. I chose unix_timestamp because that's what MySQL calls it (UNIX_TIMESTAMP and FROM_UNIXTIME), and a quick and very scientific Google poll shows me that "unix timestamp" has ~893k results, "epoch timestamp" ~463k, "posix timestamp" ~430k; and the second, third, and fifth results for "timestamp" are www.unixtimestamp.com/, www.epochconverter.com/ (the "Easy epoch/Unix timestamp converter for computer programmers.") and www.onlineconversion.com/unix_time.htm, etc. so the "Unix" name is in pretty common usage. ---------------------------------------- Feature #8096: introduce Time.current_timestamp https://bugs.ruby-lang.org/issues/8096#change-38723 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/