Compute down track RTT.

This commit is contained in:
Juliusz Chroboczek
2020-06-03 21:48:20 +02:00
parent 49bccda5ee
commit 19a65318c9
6 changed files with 55 additions and 19 deletions
+5 -1
View File
@@ -10,7 +10,7 @@ func FromDuration(d time.Duration, hz uint32) uint64 {
return uint64(d) * uint64(hz) / uint64(time.Second)
}
func toDuration(tm uint64, hz uint32) time.Duration {
func ToDuration(tm uint64, hz uint32) time.Duration {
return time.Duration(tm * uint64(time.Second) / uint64(hz))
}
@@ -29,6 +29,10 @@ func Jiffies() uint64 {
return Now(JiffiesPerSec)
}
func TimeToJiffies(tm time.Time) uint64 {
return FromDuration(tm.Sub(epoch), JiffiesPerSec)
}
var ntpEpoch = time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC)
func NTPToTime(ntp uint64) time.Time {