Class: Skylight::Util::Clock Private
- Defined in:
- lib/skylight/util/clock.rb,
ext/skylight_native.c
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A more precise clock
Class Attribute Summary collapse
- .default ⇒ Object private
Class Method Summary collapse
- .absolute_secs ⇒ Object private
- .nanos ⇒ Object private
- .secs ⇒ Object private
- .use_native! ⇒ Object private
Instance Method Summary collapse
-
#absolute_secs ⇒ Object
private
TODO: rename to secs.
-
#nanos ⇒ Object
private
TODO: remove.
-
#native_hrtime ⇒ Object
private
class Skylight::Util::Clock.
-
#secs ⇒ Object
private
TODO: remove.
-
#tick ⇒ Object
private
rubocop:disable Lint/DuplicateMethods.
Class Attribute Details
Class Method Details
.absolute_secs ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 |
# File 'lib/skylight/util/clock.rb', line 37 def absolute_secs default.absolute_secs end |
.nanos ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 |
# File 'lib/skylight/util/clock.rb', line 41 def nanos default.nanos end |
.secs ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 |
# File 'lib/skylight/util/clock.rb', line 45 def secs default.secs end |
.use_native! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 8 9 10 11 |
# File 'lib/skylight/util/clock.rb', line 5 def self.use_native! class_eval do def tick native_hrtime end end end |
Instance Method Details
#absolute_secs ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO: rename to secs
22 23 24 |
# File 'lib/skylight/util/clock.rb', line 22 def absolute_secs Time.now.to_i end |
#nanos ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO: remove
27 28 29 |
# File 'lib/skylight/util/clock.rb', line 27 def nanos tick end |
#native_hrtime ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
class Skylight::Util::Clock
171 172 173 174 175 |
# File 'ext/skylight_native.c', line 171 static VALUE clock_high_res_time(VALUE self) { UNUSED(self); return ULL2NUM(sky_hrtime()); } |
#secs ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO: remove
32 33 34 |
# File 'lib/skylight/util/clock.rb', line 32 def secs nanos / 1_000_000_000 end |
#tick ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
rubocop:disable Lint/DuplicateMethods
14 15 16 17 |
# File 'lib/skylight/util/clock.rb', line 14 def tick now = Time.now (now.to_i * 1_000_000_000) + (now.usec * 1_000) end |