Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- lib/influxdb-logger/logger.rb
Instance Method Summary collapse
Instance Method Details
#to_ms ⇒ Object
31 32 33 |
# File 'lib/influxdb-logger/logger.rb', line 31 def to_ms (self.to_r * 1000).to_i end |
#to_ns ⇒ Object
27 28 29 |
# File 'lib/influxdb-logger/logger.rb', line 27 def to_ns (self.to_r * 1000000000).to_i end |
#to_precision(precision) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 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 |