cdtime

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: ISC Imports: 2 Imported by: 5

Documentation

Overview

Package cdtime implements methods to convert from and to collectd's internal time representation, cdtime_t.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Time

type Time uint64

Time represens a time in collectd's internal representation.

func New

func New(t time.Time) Time

New returns a new Time representing time t.

func NewDuration

func NewDuration(d time.Duration) Time

NewDuration returns a new Time representing duration d.

func (Time) Duration

func (t Time) Duration() time.Duration

Duration converts and returns the duration as time.Duration.

func (Time) Float

func (t Time) Float() float64

Float returns the time as seocnds since epoch. This is a lossy conversion, which will lose up to 11 bits. This means that the returned value should be considered to have roughly microsecond precision.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements the "encoding/json".Marshaler interface for Time.

func (Time) String

func (t Time) String() string

String returns the string representation of Time. The format used is seconds since the epoch with millisecond precision, e.g. "1426588900.328".

func (Time) Time

func (t Time) Time() time.Time

Time converts and returns the time as time.Time.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the "encoding/json".Unmarshaler interface for Time.

Jump to

Keyboard shortcuts

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