units

package
v0.0.0-...-cf6bbf6 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2019 License: Apache-2.0 Imports: 0 Imported by: 144

Documentation

Overview

Package units contains the various units of measurement for a metric.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromSeconds

func FromSeconds(u Unit) float64

Returns the conversion factor between seconds and u. For example FromSeconds(Millisecond) returns 1000. Returns 1.0 if u is not a time unit.

func FromSecondsRational

func FromSecondsRational(u Unit) (numerator, denominator int64)

FromSecondsRational is the same as FromSeconds but returns answer as a rational number.

Types

type Unit

type Unit string

Unit represents a unit of measurement

const (
	Unknown       Unit = ""
	None          Unit = "None"
	Millisecond   Unit = "Milliseconds"
	Second        Unit = "Seconds"
	Celsius       Unit = "Celsius"
	Byte          Unit = "Bytes"
	BytePerSecond Unit = "BytesPerSecond"
)

func (Unit) String

func (u Unit) String() string

Jump to

Keyboard shortcuts

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