Class: Skylight::Util::Clock Private

Inherits:
Object
  • Object
show all
Defined in:
lib/skylight/util/clock.rb,
ext/skylight_native.c

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.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.absolute_secsObject

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.



31
32
33
# File 'lib/skylight/util/clock.rb', line 31

def self.absolute_secs
  default.absolute_secs
end

.defaultObject

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.



43
44
45
# File 'lib/skylight/util/clock.rb', line 43

def self.default
  @clock ||= Clock.new
end

.default=(clock) ⇒ 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.



47
48
49
# File 'lib/skylight/util/clock.rb', line 47

def self.default=(clock)
  @clock = clock
end

.nanosObject

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.



35
36
37
# File 'lib/skylight/util/clock.rb', line 35

def self.nanos
  default.nanos
end

.secsObject

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.



39
40
41
# File 'lib/skylight/util/clock.rb', line 39

def self.secs
  default.secs
end

Instance Method Details

#absolute_secsObject

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



17
18
19
# File 'lib/skylight/util/clock.rb', line 17

def absolute_secs
  Time.now.to_i
end

#nanosObject

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



22
23
24
# File 'lib/skylight/util/clock.rb', line 22

def nanos
  tick
end

#native_hrtimeObject

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



140
141
142
143
144
# File 'ext/skylight_native.c', line 140

static VALUE
clock_high_res_time(VALUE self) {
  UNUSED(self);
  return ULL2NUM(sky_hrtime());
}

#secsObject

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 secs
  nanos / 1_000_000_000
end

#tickObject

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.



6
7
8
# File 'lib/skylight/util/clock.rb', line 6

def tick
  native_hrtime
end