Sha256: 42b0fa8439e9dfe57223ed0c0c2acd64b115264a36a53994574c4ee97cfd031d
Contents?: true
Size: 947 Bytes
Versions: 16
Compression:
Stored size: 947 Bytes
Contents
module Skylight module Util # A more precise clock class Clock def self.use_native! class_eval do def tick native_hrtime end end end # rubocop:disable Lint/DuplicateMethods def tick now = Time.now (now.to_i * 1_000_000_000) + (now.usec * 1_000) end # rubocop:enable Lint/DuplicateMethods # TODO: rename to secs def absolute_secs Time.now.to_i end # TODO: remove def nanos tick end # TODO: remove def secs nanos / 1_000_000_000 end class << self def absolute_secs default.absolute_secs end def nanos default.nanos end def secs default.secs end def default @default ||= Clock.new end attr_writer :default end end end end
Version data entries
16 entries across 16 versions & 1 rubygems