class Time

Public Instance Methods

to_ms() click to toggle source
# File lib/influxdb-logger/logger.rb, line 31
def to_ms
  (self.to_r * 1000).to_i
end
to_ns() click to toggle source
# File lib/influxdb-logger/logger.rb, line 27
def to_ns
  (self.to_r * 1000000000).to_i
end
to_precision(precision) click to toggle source
# File lib/influxdb-logger/logger.rb, line 8
def to_precision(precision)
  case precision
  when 'ns'
    self.to_ns
  when 'u'
    (self.to_r * 1000000).to_i
  when 'ms'
    self.to_ms
  when 's'
    self.to_i
  when 'm'
    self.to_i / 60
  when 'h'
    self.to_i / 3600
  else
    self.to_ns
  end
end