Class: Amplitude::Formatters::Time
- Inherits:
-
Object
- Object
- Amplitude::Formatters::Time
- Defined in:
- lib/amplitude/formatters/time.rb
Class Method Summary collapse
Class Method Details
.call(time) ⇒ Object
4 5 6 7 8 |
# File 'lib/amplitude/formatters/time.rb', line 4 def call(time) return time if time.nil? guess = time.to_i ::Time.at(guess) > ::Time.now ? guess : convert_to_ms(time) end |
.convert_to_ms(time) ⇒ Object
10 11 12 |
# File 'lib/amplitude/formatters/time.rb', line 10 def convert_to_ms(time) (time.to_f * 1_000).to_i end |