module StatsdTcp::MonotonicTime

MonotonicTime guarantees that the time is strictly linearly increasing (unlike realtime). @see pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html

Public Class Methods

time_in_ms() click to toggle source

@return [Integer] current monotonic time in milliseconds

# File lib/statsd_tcp/monotonic_time.rb, line 13
def time_in_ms
  time_in_nanoseconds / (10.0 ** 6)
end

Private Class Methods

time_in_nanoseconds() click to toggle source
# File lib/statsd_tcp/monotonic_time.rb, line 20
def time_in_nanoseconds
  Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)
end