class Avromatic::Model::Types::TimestampMillisType
This subclass is used to truncate timestamp values to milliseconds.
Public Instance Methods
Source
# File lib/avromatic/model/types/timestamp_millis_type.rb, line 12 def name 'timestamp-millis' end
Source
# File lib/avromatic/model/types/timestamp_millis_type.rb, line 16 def referenced_model_classes EMPTY_ARRAY end
Private Instance Methods
Source
# File lib/avromatic/model/types/timestamp_millis_type.rb, line 26 def coerce_time(input) # value is coerced to a local Time # The Avro representation of a timestamp is Epoch seconds, independent # of time zone. ::Time.at(input.to_i, input.usec / 1000 * 1000) end
Source
# File lib/avromatic/model/types/timestamp_millis_type.rb, line 22 def truncated?(value) value.nsec % 1_000_000 == 0 end