clair: Index | Files

package timeutil

import ""

Package timeutil implements extra utilities dealing with time not found in the standard library.


Package Files


func ApproxSleep Uses

func ApproxSleep(approxWakeup time.Time, st *stopper.Stopper) (stopped bool)

ApproxSleep is a stoppable time.Sleep that adds a slight random variation to the wakeup time in order to prevent thundering herds.

func ExpBackoff Uses

func ExpBackoff(prev, max time.Duration) time.Duration

ExpBackoff doubles the backoff time, if the result is longer than the parameter max, max will be returned.

func FractionalDuration Uses

func FractionalDuration(fraction float64, d time.Duration) time.Duration

FractionalDuration calculates the fraction of a Duration rounding half way from zero.

Package timeutil imports 5 packages (graph) and is imported by 3 packages. Updated 2019-02-15. Refresh now. Tools for package owners.