class Avromatic::Model::Types::TimestampMicrosType
This subclass is used to truncate timestamp values to microseconds.
Public Instance Methods
Source
# File lib/avromatic/model/types/timestamp_micros_type.rb, line 12 def name 'timestamp-micros' end
Source
# File lib/avromatic/model/types/timestamp_micros_type.rb, line 16 def referenced_model_classes EMPTY_ARRAY end
Private Instance Methods
Source
# File lib/avromatic/model/types/timestamp_micros_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) end
Source
# File lib/avromatic/model/types/timestamp_micros_type.rb, line 22 def truncated?(value) value.nsec % 1_000 == 0 end