module Cadence::Utils

Constants

MILLI
NANO

Public Class Methods

time_from_nanos(timestamp) click to toggle source
# File lib/cadence/utils.rb, line 7
def time_from_nanos(timestamp)
  seconds, nanoseconds = timestamp.divmod(NANO)
  Time.at(seconds, nanoseconds, :nsec)
end
time_to_nanos(time) click to toggle source
# File lib/cadence/utils.rb, line 12
def time_to_nanos(time)
  time.to_f * NANO
end