Project

timestamp

0.0
No commit activity in last 3 years
No release in over 3 years
== Time.timestamp Defines <tt>Time::timestamp</tt> and <tt>Time::unix_timestamp</tt>. See the original discussion at {Ruby-Lang}[https://bugs.ruby-lang.org/issues/8096] :call-seq: Time::timestamp -> Integer Returns a nanosecond-precision timestamp from the system's monotonic clock. Note that the resolution of the measured time is system- dependent (i.e. while the value displayed is always an integer number of nanoseconds, the values may not necessarily change in increments of exactly one). This time value does not correlate to any absolute, real-world time system; it is only useful for measuring relative (or elapsed) times at a high granularity. For example, benchmark measurements. :call-seq: Time::unix_timestamp -> Integer Time::unix_time -> Integer Returns the current real-world time as a whole number of seconds since the Epoch (1-Jan-1970). :call-seq: Time::unix_microtime -> Float Returns the current real-world time as a floating-point number of seconds since the Epoch (1-Jan-1970).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

timestamp

# Nanosecond monotonic clock:
Time.timestamp       #=> int
# Seconds since the Epoch:
Time.unix_timestamp  #=> int
Time.unix_microtime  #=> float

Benchmarks

Tested on two similarly-spec'd Ubuntu VMs, using a recent ruby 2.1.0 build.

64-Bit VM:

                           user     system      total        real
Time.now.to_i          0.080000   5.440000   5.520000 (  5.533965)
Time.unix_timestamp    0.060000   0.000000   0.060000 (  0.060482)

Time.now.to_f          0.180000   6.840000   7.020000 (  7.012264)
Time.unix_microtime    0.020000   4.190000   4.210000 (  4.209150)

Time.timestamp         0.040000   4.340000   4.380000 (  4.384826)

32-Bit VM:

Time.now.to_i          0.200000   5.310000   5.510000 (  5.523720)
Time.unix_timestamp    0.160000   0.030000   0.190000 (  0.183468)

Time.now.to_f          0.340000   5.260000   5.600000 (  5.602743)
Time.unix_microtime    0.140000   4.160000   4.300000 (  4.301589)

Time.timestamp         0.070000   4.320000   4.390000 (  4.392840)