Module: Karafka::Core::Helpers::Time

Included in:
Monitoring::Notifications, Monitoring::StatisticsDecorator
Defined in:
lib/karafka/core/helpers/time.rb

Overview

Time related methods used across Karafka

Instance Method Summary collapse

Instance Method Details

#float_nowFloat

Returns current time in float.

Returns:

  • (Float)

    current time in float



22
23
24
# File 'lib/karafka/core/helpers/time.rb', line 22

def float_now
  ::Process.clock_gettime(::Process::CLOCK_REALTIME)
end

#monotonic_nowFloat

Returns current monotonic time in milliseconds.

Returns:

  • (Float)

    current monotonic time in milliseconds



11
12
13
# File 'lib/karafka/core/helpers/time.rb', line 11

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