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



15
16
17
# File 'lib/karafka/core/helpers/time.rb', line 15

def float_now
  ::Time.now.utc.to_f
end

#monotonic_nowFloat

Returns current monotonic time in milliseconds.

Returns:

  • (Float)

    current monotonic time in milliseconds



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

def monotonic_now
  ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) * 1_000
end