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 ¶
Types ¶
type 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.
Click to show internal directories.
Click to hide internal directories.