luci: go.chromium.org/luci/common/clock/clockflag Index | Files

package clockflag

import "go.chromium.org/luci/common/clock/clockflag"

Index

Package Files

duration.go time.go

Constants

const DurationHelp = "A duration string is a sequence of <number><unit> such as 2h15m. " +
    "Supported units are 'ns', 'us'/'µs', 'ms', 's', 'm', and 'h'."

DurationHelp is generic Duration help.

func FormatDuration Uses

func FormatDuration(d time.Duration) string

FormatDuration formats a time.Duration into a string that can be parsed with ParseDuration.

type Duration Uses

type Duration time.Duration

Duration is a Flag- and JSON-compatible Duration value.

func ParseDuration Uses

func ParseDuration(v string) (Duration, error)

ParseDuration parses a clockflag Duration from a string. This is basically a typed fall-through to time.ParseDuration.

func (Duration) IsZero Uses

func (d Duration) IsZero() bool

IsZero tests if this Duration is the zero value.

func (Duration) MarshalJSON Uses

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

Marshals a Duration into a duration string.

func (*Duration) Set Uses

func (d *Duration) Set(value string) (err error)

Set implements flag.Value.

func (*Duration) String Uses

func (d *Duration) String() string

func (*Duration) UnmarshalJSON Uses

func (d *Duration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Unmarshals a JSON entry into the underlying type. The entry is expected to contain a string corresponding to one of the enum's keys.

type Time Uses

type Time time.Time

Time is a flag- and JSON-compatible Time which parses from RFC3339 strings.

func (Time) MarshalJSON Uses

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

MarshalJSON implements json.Marshaler.

Marshals a Time into an RFC3339 time string.

func (*Time) Set Uses

func (t *Time) Set(value string) error

Set implements flag.Value.

func (*Time) String Uses

func (t *Time) String() string

func (Time) Time Uses

func (t Time) Time() time.Time

Time returns the Time value associated with this Time.

func (*Time) UnmarshalJSON Uses

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

UnmarshalJSON implements json.Unmarshaler.

Unmarshals a JSON entry into the underlying type. The entry is expected to contain a string corresponding to one of the enum's keys.

Package clockflag imports 4 packages (graph) and is imported by 14 packages. Updated 2018-12-18. Refresh now. Tools for package owners.