Timestamp (Ruby Gem)

Defines Time::timestamp and Time::unix_timestamp.

See the original discussion at Ruby-Lang (bugs.ruby-lang.org).

gem
rubygems.org/gems/timestamp
license
ISC
ci-status
Build Status

Time

Public Class Methods

timestamp

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.

Time.timestamp # => 17817203921822

unix_timestamp

unix_time

Returns the current real-world time as a whole number of seconds since the Epoch (1-Jan-1970).

Time.unix_timestamp # => 1363352771
Time.unix_time      # => 1363352771

unix_microtime

Returns the current real-world time as a floating-point number of seconds since the Epoch (1-Jan-1970).

Time.unix_microtime # => 1363352771.315240