Sha256: da14821256e1844e02adfdfce2f7c6f0498288e596b382ce87d3bf8e126df798

Contents?: true

Size: 578 Bytes

Versions: 3

Compression:

Stored size: 578 Bytes

Contents

require 'thrift/types/known/timestamp_types'

module Thrift
  module Types
    module Known
      module Timestamp
        class << self
          def from_time(v)
            Timestamp.from_time(v)
          end

          def now
            from_time(Time.now)
          end
        end

        class Timestamp
          class << self
            def from_time(v)
              Timestamp.new(seconds: v.to_i, nanos: v.nsec)
            end
          end

          def to_time
            Time.at(seconds, nanos, :nsec)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
upfluence-thrift-2.4.4 lib/thrift/types/known/timestamp.rb
upfluence-thrift-2.3.1 lib/thrift/types/known/timestamp.rb
upfluence-thrift-2.3.0 lib/thrift/types/known/timestamp.rb