duration

package
v3.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HOUR  = time.Minute * 60
	DAY   = HOUR * 24
	WEEK  = 7 * DAY
	MONTH = 30 * DAY
	YEAR  = 365 * DAY
)

Units of Durations

Variables

This section is empty.

Functions

func String

func String(d Duration) string

String converts the default time.Duration to a slightly more human readable format

Types

type Duration

type Duration = time.Duration

Duration represents the elapsed time between two instants as a time.Duration. It adds a few extras for working with the scale of CCI

type MovingAverage

type MovingAverage struct {
	// contains filtered or unexported fields
}

MovingAverage allows for the calculation of a [cumulative moving average](https://en.wikipedia.org/wiki/Moving_average)

func (*MovingAverage) Append

func (m *MovingAverage) Append(t time.Duration)

Append a duration of time to the current moving average

func (*MovingAverage) Combine

func (m *MovingAverage) Combine(a MovingAverage)

Combine a second moving average into the current

func (*MovingAverage) GetCurrentAverage

func (m *MovingAverage) GetCurrentAverage() time.Duration

GetCurrentAverage returns the current aaverage field if it's non-nil, zero value otherwise.

Jump to

Keyboard shortcuts

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