Class: Spectator::ManualClock

Inherits:
Object
  • Object
show all
Defined in:
lib/spectator/clock.rb

Overview

A timing source useful in unit tests that can be used to mock the methods in SystemClock

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wall_init: Time.utc(2000, 'jan', 1, 0, 0, 0), mono_time: 0) ⇒ ManualClock

Get a new object using 2000-1-1 0:0:0 UTC as the default time, and 0 nanoseconds as the number of nanos reported by monotonic_time



29
30
31
32
# File 'lib/spectator/clock.rb', line 29

def initialize(wall_init: Time.utc(2000, 'jan', 1, 0, 0, 0), mono_time: 0)
  @wall_time = wall_init
  @monotonic_time = mono_time
end

Instance Attribute Details

#monotonic_timeObject

Returns the value of attribute monotonic_time.



25
26
27
# File 'lib/spectator/clock.rb', line 25

def monotonic_time
  @monotonic_time
end

#wall_timeObject

Returns the value of attribute wall_time.



24
25
26
# File 'lib/spectator/clock.rb', line 24

def wall_time
  @wall_time
end