Make duration functions work with negative values.

This commit is contained in:
Juliusz Chroboczek
2022-04-15 03:35:34 +02:00
parent d36111d9f9
commit 99055e5cae
5 changed files with 32 additions and 13 deletions
+4 -2
View File
@@ -23,8 +23,10 @@ type Estimator struct {
// New creates a new estimator that estimates rate over the last interval.
func New(interval time.Duration) *Estimator {
return &Estimator{
interval: rtptime.FromDuration(interval, rtptime.JiffiesPerSec),
time: rtptime.Now(rtptime.JiffiesPerSec),
interval: uint64(
rtptime.FromDuration(interval, rtptime.JiffiesPerSec),
),
time: rtptime.Now(rtptime.JiffiesPerSec),
}
}