Class: Spectator::SystemClock
- Inherits:
-
Object
- Object
- Spectator::SystemClock
- Defined in:
- lib/spectator/clock.rb
Overview
A timing source that can be used to access the current time as an object, and a high resolution monotonic time
Instance Method Summary collapse
-
#monotonic_time ⇒ Object
A monotonically increasing number of nanoseconds.
-
#wall_time ⇒ Object
A time object for the current time.
Instance Method Details
#monotonic_time ⇒ Object
A monotonically increasing number of nanoseconds. This is useful for recording times, or benchmarking. Note that this is not guaranteed to be steady. In other words each tick of the underlying clock may not be the same length (e.g. some seconds might be longer than others)
11 12 13 |
# File 'lib/spectator/clock.rb', line 11 def monotonic_time MonotonicTime.time_in_nanoseconds end |
#wall_time ⇒ Object
Returns a time object for the current time.
16 17 18 |
# File 'lib/spectator/clock.rb', line 16 def wall_time Time.now end |