timeutil

package
v0.0.0-...-41c8d9c Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApproxSleep

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

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

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

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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