Class: Neo4j::Driver::Internal::ClockAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/driver/internal/clock_adapter.rb

Overview

Adapts a #now_millis time source (epoch milliseconds) to the driver's monotonic/realtime Clock interface. The MRI counterpart of the jruby ClockAdapter that bridges #now_millis into a java.time.Clock; DriverFactory#to_clock wraps testkit-backend's clock in it so the driver internals consume it like any other Clock.

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ ClockAdapter

Returns a new instance of ClockAdapter.



12
13
14
# File 'lib/neo4j/driver/internal/clock_adapter.rb', line 12

def initialize(source)
  @source = source
end

Instance Method Details

#monotonicObject



16
# File 'lib/neo4j/driver/internal/clock_adapter.rb', line 16

def monotonic = @source.now_millis / 1000.0

#realtimeObject



17
# File 'lib/neo4j/driver/internal/clock_adapter.rb', line 17

def realtime = ::Time.at(@source.now_millis / 1000.0)