nnduration

package
v0.0.0-...-c2e30b8 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: NIST-PD-fallback Imports: 4 Imported by: 3

Documentation

Overview

Package nnduration provides JSON-friendly non-negative duration types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Milliseconds

type Milliseconds uint64

Milliseconds is a duration in milliseconds unit.

func (Milliseconds) Duration

func (d Milliseconds) Duration() time.Duration

Duration converts this to time.Duration.

func (Milliseconds) DurationOr

func (d Milliseconds) DurationOr(dflt Milliseconds) time.Duration

DurationOr converts this to time.Duration, but returns dflt if this is zero.

func (*Milliseconds) UnmarshalJSON

func (d *Milliseconds) UnmarshalJSON(p []byte) (e error)

UnmarshalJSON implements json.Unmarshaler interface. It accepts either an integer as milliseconds, or a duration string specified by time.ParseDuration.

type Nanoseconds

type Nanoseconds uint64

Nanoseconds is a duration in nanoseconds unit.

func (Nanoseconds) Duration

func (d Nanoseconds) Duration() time.Duration

Duration converts this to time.Duration.

func (Nanoseconds) DurationOr

func (d Nanoseconds) DurationOr(dflt Nanoseconds) time.Duration

DurationOr converts this to time.Duration, but returns dflt if this is zero.

func (*Nanoseconds) UnmarshalJSON

func (d *Nanoseconds) UnmarshalJSON(p []byte) (e error)

UnmarshalJSON implements json.Unmarshaler interface. It accepts either an integer as nanoseconds, or a duration string specified by time.ParseDuration.

Jump to

Keyboard shortcuts

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