Proposal Details
This is kinda annoying:
delay := time.Duration( float64(baseDelay) * backoffFactor )
It would be nicer if you could just do this:
delay := baseDelay.Scale(backoffFactor)
You could paste this in each package you were needing this:
func scaleDuration(d time.Duration, s float64) time.Duration {
return time.Duration(float64(d) * s)
}
...but probably nicer built into time.Duration
?
Have a good day :)
Comment From: seankhliao
Since this is not a fundamental operation on durations, helpers like this fall in to the category of https://go.dev/doc/faq#x_in_std
Comment From: zigo101
Since this is not a fundamental operation on durations,
This is used quite common.