Sha256: 6caad93ba205a065dd0b8d303652011815f4be159bb1f0547a058e6d99991d89

Contents?: true

Size: 693 Bytes

Versions: 2

Compression:

Stored size: 693 Bytes

Contents

module Vedeu

  module Logging

    # If the system supports Process::CLOCK_MONOTONIC use that for
    # timestamps.
    #
    #    Vedeu.clock_time # => 15217.232113 (Process::CLOCK_MONOTONIC)
    #                     # => 1447196800.3098037 (Time.now)
    #
    module ClockTime

      if defined?(Process::CLOCK_MONOTONIC)
        def self.clock_time
          Process.clock_gettime(Process::CLOCK_MONOTONIC)
        end

      else
        def self.clock_time
          Time.now
        end

      end

    end # ClockTime

  end # Logging

  # @!method clock_time
  #   @see Vedeu::Logging::ClockTime
  def_delegators Vedeu::Logging::ClockTime,
                 :clock_time

end # Vedeu

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.6.53 lib/vedeu/logging/clock_time.rb
vedeu-0.6.52 lib/vedeu/logging/clock_time.rb