Class: Neo4j::Driver::Internal::ClockAdapter
- Inherits:
-
Object
- Object
- Neo4j::Driver::Internal::ClockAdapter
- 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
-
#initialize(source) ⇒ ClockAdapter
constructor
A new instance of ClockAdapter.
- #monotonic ⇒ Object
- #realtime ⇒ Object
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
#monotonic ⇒ Object
16 |
# File 'lib/neo4j/driver/internal/clock_adapter.rb', line 16 def monotonic = @source.now_millis / 1000.0 |
#realtime ⇒ Object
17 |
# File 'lib/neo4j/driver/internal/clock_adapter.rb', line 17 def realtime = ::Time.at(@source.now_millis / 1000.0) |