timeconv

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package timeconv provides time conversion capabilities to Trickster

Index

Constants

This section is empty.

Variables

View Source
var UnitMap = map[string]time.Duration{
	"ns": time.Nanosecond,
	"u":  time.Microsecond,
	"µ":  time.Microsecond,
	"μ":  time.Microsecond,
	"us": time.Microsecond,
	"µs": time.Microsecond,
	"μs": time.Microsecond,
	"ms": time.Millisecond,
	"s":  time.Second,
	"m":  time.Minute,
	"h":  time.Hour,
	"d":  24 * time.Hour,
	"w":  24 * 7 * time.Hour,
	"y":  24 * 365 * time.Hour,
}

UnitMap provides a map of common time unit abbreviations to their respective time.Durations

Functions

func ParseDuration

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

ParseDuration returns a duration from a string. Slightly improved over the builtin, since it supports units larger than hour.

func ParseDurationParts

func ParseDurationParts(value int64, units string) (time.Duration, error)

ParseDurationParts returns a time.Duration from a value and unit

Types

This section is empty.

Jump to

Keyboard shortcuts

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