Module: Avro::LogicalTypes::TimestampMillis
- Defined in:
- lib/avro-patches/logical_types/logical_types.rb
Class Method Summary collapse
Class Method Details
.decode(int) ⇒ Object
23 24 25 26 |
# File 'lib/avro-patches/logical_types/logical_types.rb', line 23 def self.decode(int) s, ms = int / 1000, int % 1000 Time.at(s, ms * 1000).utc end |
.encode(value) ⇒ Object
18 19 20 21 |
# File 'lib/avro-patches/logical_types/logical_types.rb', line 18 def self.encode(value) time = value.to_time time.to_i * 1000 + time.usec / 1000 end |