aghtime

package
v0.107.0-b.12 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package aghtime defines some types for convenient work with time values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration struct {
	// time.Duration is embedded here to avoid implementing all the methods.
	time.Duration
}

Duration is a wrapper for time.Duration providing functionality for encoding.

func (Duration) MarshalText

func (d Duration) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface for Duration.

func (Duration) String

func (d Duration) String() (str string)

String implements the fmt.Stringer interface for Duration. It wraps time.Duration.String method and additionally cuts off non-leading zero values of minutes and seconds. Some values which are differ between the implementations:

Duration:   "1m", time.Duration:   "1m0s"
Duration:   "1h", time.Duration: "1h0m0s"
Duration: "1h1m", time.Duration: "1h1m0s"

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(b []byte) (err error)

UnmarshalText implements the encoding.TextUnmarshaler interface for *Duration.

TODO(e.burkov): Make it able to parse larger units like days.

Jump to

Keyboard shortcuts

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