Sha256: 18ca0bd49a51e369770f9a877154e4e2f3dfbdd89e0813d5f60a951a8472ca95

Contents?: true

Size: 531 Bytes

Versions: 9

Compression:

Stored size: 531 Bytes

Contents

module Skylight
  module Util
    class Clock

      def absolute_secs
        Time.now.to_i
      end

      def nanos
        native_hrtime
      end

      def secs
        nanos / 1_000_000_000
      end

      def self.absolute_secs
        default.absolute_secs
      end

      def self.nanos
        default.nanos
      end

      def self.secs
        default.secs
      end

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

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

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
skylight-0.3.6 lib/skylight/util/clock.rb
skylight-0.3.3 lib/skylight/util/clock.rb
skylight-0.3.2 lib/skylight/util/clock.rb
skylight-0.3.1 lib/skylight/util/clock.rb
skylight-0.3.0 lib/skylight/util/clock.rb
skylight-0.3.0.rc.6 lib/skylight/util/clock.rb
skylight-0.3.0.rc.5 lib/skylight/util/clock.rb
skylight-0.3.0.rc.4 lib/skylight/util/clock.rb
skylight-0.3.0.rc.3 lib/skylight/util/clock.rb