xtime

package
v3.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: AGPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Day  time.Duration = time.Hour * 24
	Week               = Day * 7
)

Additional durations, a day is considered to be 24 hours

Variables

This section is empty.

Functions

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string. The following code is borrowed from time.ParseDuration https://cs.opensource.google/go/go/+/refs/tags/go1.22.5:src/time/format.go;l=1589 This function extends this function by allowing support for days and weeks. This function must only be used when days and weeks are necessary inputs in all other cases it is preferred that a user uses Go's time.ParseDuration

Types

type Duration added in v3.0.7

type Duration time.Duration

Duration is a wrapper around time.Duration that supports YAML and JSON

func (*Duration) UnmarshalJSON added in v3.0.7

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

UnmarshalJSON implements json.Unmarshaler

func (*Duration) UnmarshalYAML added in v3.0.7

func (d *Duration) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler

Jump to

Keyboard shortcuts

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