Sha256: bdccbd3790f1d9402dc5ffae1b40cfac887842758ffe98afdad4411be159f10c
Contents?: true
Size: 788 Bytes
Versions: 17
Compression:
Stored size: 788 Bytes
Contents
# frozen_string_literal: true require 'avromatic/model/types/abstract_timestamp_type' module Avromatic module Model module Types # This subclass is used to truncate timestamp values to microseconds. class TimestampMicrosType < Avromatic::Model::Types::AbstractTimestampType def name 'timestamp-micros' end def referenced_model_classes EMPTY_ARRAY end private def truncated?(value) value.nsec % 1_000 == 0 end 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 end end end end
Version data entries
17 entries across 17 versions & 1 rubygems