Module: HotCell::Clock

Defined in:
lib/hot_cell/clock.rb

Overview

Monotonic, because every duration here is reported to a caller that will alarm on it, and a clock that can step backwards produces negative latencies during an NTP correction.

Class Method Summary collapse

Class Method Details

.ms_since(at) ⇒ Object



12
13
14
# File 'lib/hot_cell/clock.rb', line 12

def ms_since(at)
  ((now - at) * 1000).round(2)
end

.nowObject



8
9
10
# File 'lib/hot_cell/clock.rb', line 8

def now
  Process.clock_gettime Process::CLOCK_MONOTONIC
end