Module: Rdkafka::Helpers::Time

Included in:
AbstractHandle, Consumer, Producer, Producer::PartitionsCountCache
Defined in:
lib/rdkafka/helpers/time.rb

Overview

Time related methods used across Karafka

Instance Method Summary collapse

Instance Method Details

#monotonic_nowFloat

Returns current monotonic time in seconds with microsecond precision.

Returns:

  • (Float)

    current monotonic time in seconds with microsecond precision



9
10
11
# File 'lib/rdkafka/helpers/time.rb', line 9

def monotonic_now
  ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
end

#monotonic_now_msInteger

Returns current monotonic time in milliseconds.

Returns:

  • (Integer)

    current monotonic time in milliseconds



14
15
16
# File 'lib/rdkafka/helpers/time.rb', line 14

def monotonic_now_ms
  ::Process.clock_gettime(::Process::CLOCK_MONOTONIC, :millisecond)
end