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