Sha256: ccbffbad65ca59c163549b1bd2c62216078b2195d3ffe7657cfe3e1eda990eb1

Contents?: true

Size: 672 Bytes

Versions: 4

Compression:

Stored size: 672 Bytes

Contents

# frozen_string_literal: true

module Vedeu

  module Logging

    # If the system supports Process::CLOCK_MONOTONIC use that for
    # timestamps.
    #
    # @api public
    #
    module ClockTime

      # {include:file:docs/dsl/by_method/clock_time.md}
      # @return [Float|Time]
      def self.clock_time
        if defined?(Process::CLOCK_MONOTONIC)
          Process.clock_gettime(Process::CLOCK_MONOTONIC)

        else
          Time.now

        end
      end

    end # ClockTime

  end # Logging

  # @!method clock_time
  # {include:file:docs/dsl/by_method/clock_time.md}
  def_delegators Vedeu::Logging::ClockTime,
                 :clock_time

end # Vedeu

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.8.10 lib/vedeu/logging/clock_time.rb
vedeu-0.8.9 lib/vedeu/logging/clock_time.rb
vedeu-0.8.8 lib/vedeu/logging/clock_time.rb
vedeu-0.8.7 lib/vedeu/logging/clock_time.rb