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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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