File: monotonic_time.rb

package info (click to toggle)
ruby-concurrent 1.3.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,136 kB
  • sloc: ruby: 30,875; java: 6,128; ansic: 265; makefile: 26; sh: 19
file content (19 lines) | stat: -rw-r--r-- 642 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Concurrent

  # @!macro monotonic_get_time
  #
  #   Returns the current time as tracked by the application monotonic clock.
  #
  #   @param [Symbol] unit the time unit to be returned, can be either
  #     :float_second, :float_millisecond, :float_microsecond, :second,
  #     :millisecond, :microsecond, or :nanosecond default to :float_second.
  #
  #   @return [Float] The current monotonic time since some unspecified
  #     starting point
  #
  #   @!macro monotonic_clock_warning
  def monotonic_time(unit = :float_second)
    Process.clock_gettime(Process::CLOCK_MONOTONIC, unit)
  end
  module_function :monotonic_time
end