File: timestamp.rb

package info (click to toggle)
ruby-msgpack 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 972 kB
  • sloc: ruby: 4,789; ansic: 4,309; java: 1,809; makefile: 4
file content (44 lines) | stat: -rw-r--r-- 1,195 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
module MessagePack
  # A utility class for MessagePack timestamp type
  class Timestamp
    #
    # The timestamp extension type defined in the MessagePack spec.
    #
    # See https://github.com/msgpack/msgpack/blob/master/spec.md#timestamp-extension-type for details.
    #
    TYPE = -1

    # @return [Integer] Second part of the timestamp.
    attr_reader :sec

    # @return [Integer] Nanosecond part of the timestamp.
    attr_reader :nsec

    # @param [Integer] sec
    # @param [Integer] nsec
    def initialize(sec, nsec)
    end

    # @example An unpacker implementation for the Time class
    #   lambda do |payload|
    #     tv = MessagePack::Timestamp.from_msgpack_ext(payload)
    #     Time.at(tv.sec, tv.nsec, :nanosecond)
    #   end
    #
    # @param [String] data
    # @return [MessagePack::Timestamp]
    def self.from_msgpack_ext(data)
    end

    # @example A packer implementation for the Time class
    #   unpacker = lambda do |time|
    #     MessagePack::Timestamp.to_msgpack_ext(time.tv_sec, time.tv_nsec)
    #   end
    #
    # @param [Integer] sec
    # @param [Integer] nsec
    # @return [String]
    def self.to_msgpack_ext(sec, nsec)
    end
  end
end