delaytimer

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2018 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayTimer

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

DelayTimer calculates delayed duration, it use current duration compares with the average duration of latest n duration.

func New

func New(num int) *DelayTimer

New creates a new DelayTimer.

func (*DelayTimer) Calc

func (dc *DelayTimer) Calc(d time.Duration) time.Duration

Calc calculates calculates delay then append current duration into cache, always return 0 if delay duration less than 0.

Jump to

Keyboard shortcuts

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