1
2
3
4
5 package quic
6
7 import (
8 "math"
9 "time"
10 )
11
12
13
14 type unscaledAckDelay int64
15
16 func unscaledAckDelayFromDuration(d time.Duration, ackDelayExponent uint8) unscaledAckDelay {
17 return unscaledAckDelay(d.Microseconds() >> ackDelayExponent)
18 }
19
20 func (d unscaledAckDelay) Duration(ackDelayExponent uint8) time.Duration {
21 if int64(d) > (math.MaxInt64>>ackDelayExponent)/int64(time.Microsecond) {
22
23 return 0
24 }
25 return time.Duration(d<<ackDelayExponent) * time.Microsecond
26 }
27
View as plain text