timestamp

package module
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2021 License: MIT Imports: 5 Imported by: 2

README

Timestamp

Standard cross-language timestamp object.

Introduction

This is a simple protobuf encoding for timestamps.

Note: in most cases you will want to use the built-in Protobuf timestamp. This is just a helpful implementation for those cases where a simpler uint64 millisecond representation makes more sense.

Documentation

Overview

Package timestamp is a generated protocol buffer package.

It is generated from these files:

github.com/aperturerobotics/timestamp/timestamp.proto

It has these top-level messages:

Timestamp

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToTime

func ToTime(t uint64) time.Time

ToTime generates a time object from a millisecond timestamp.

Types

type Timestamp

type Timestamp struct {
	// TimeUnixMs timestamp in unix milliseconds.
	TimeUnixMs uint64 `protobuf:"varint,1,opt,name=time_unix_ms,json=timeUnixMs" json:"time_unix_ms,omitempty"`
}

Timestamp contains a cross-platform timestamp.

func Now

func Now() Timestamp

Now returns a timestamp for now.

func ToTimestamp

func ToTimestamp(t time.Time) Timestamp

ToTimestamp generates a millisecond timestamp from the time object.

func (*Timestamp) Descriptor

func (*Timestamp) Descriptor() ([]byte, []int)

func (*Timestamp) GetTimeUnixMs

func (m *Timestamp) GetTimeUnixMs() uint64

func (*Timestamp) ProtoMessage

func (*Timestamp) ProtoMessage()

func (*Timestamp) Reset

func (m *Timestamp) Reset()

func (*Timestamp) String

func (m *Timestamp) String() string

func (*Timestamp) ToTime

func (t *Timestamp) ToTime() time.Time

ToTime converts the Timestamp to a time.Time

func (*Timestamp) Validate

func (t *Timestamp) Validate() error

Validate checks the timestamp.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL