Module: Avro::LogicalTypes::TimestampMicros
- Defined in:
- lib/avro-patches/logical_types/logical_types.rb
Class Method Summary collapse
Class Method Details
.decode(int) ⇒ Object
41 42 43 44 |
# File 'lib/avro-patches/logical_types/logical_types.rb', line 41 def self.decode(int) s, us = int / 1000_000, int % 1000_000 Time.at(s, us).utc end |
.encode(value) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/avro-patches/logical_types/logical_types.rb', line 34 def self.encode(value) return value.to_i if value.is_a?(Numeric) time = value.to_time time.to_i * 1000_000 + time.usec end |