Module: Concord::Utils

Extended by:
Utils
Included in:
Utils
Defined in:
lib/concord/utils.rb

Overview

Some helper functions useful in client computations

Instance Method Summary collapse

Instance Method Details

#log_to_stderr(str) ⇒ Object

Log message to stderr

Parameters:

  • str (String)

    The message to print to stderr



13
14
15
16
# File 'lib/concord/utils.rb', line 13

def log_to_stderr(str)
  $stderr.puts str
  $stderr.flush
end

#time_millis(t = Time.now) ⇒ Object

Get the time in milliseconds

Parameters:

  • t (Time) (defaults to: Time.now)

    The time to convert to milliseconds



7
8
9
# File 'lib/concord/utils.rb', line 7

def time_millis(t = Time.now)
  (t.to_f * 1000.0).to_i
end