timeconv

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 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]int64{
	"ns": int64(time.Nanosecond),
	"us": int64(time.Microsecond),
	"µs": int64(time.Microsecond),
	"μs": int64(time.Microsecond),
	"ms": int64(time.Millisecond),
	"s":  int64(time.Second),
	"m":  int64(time.Minute),
	"h":  int64(time.Hour),
	"d":  int64(24 * time.Hour),
	"w":  int64(24 * 7 * time.Hour),
	"y":  int64(24 * 365 * time.Hour),
}

UnitMap provides a map of common time unit indicators to nanoseconds of duration per unit

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