Run gofmt.
This commit is contained in:
+2
-2
@@ -39,7 +39,7 @@ func NTPToTime(ntp uint64) time.Time {
|
||||
sec := uint32(ntp >> 32)
|
||||
frac := uint32(ntp & 0xFFFFFFFF)
|
||||
return ntpEpoch.Add(
|
||||
time.Duration(sec) * time.Second +
|
||||
time.Duration(sec)*time.Second +
|
||||
((time.Duration(frac) * time.Second) >> 32),
|
||||
)
|
||||
}
|
||||
@@ -48,5 +48,5 @@ func TimeToNTP(tm time.Time) uint64 {
|
||||
d := tm.Sub(ntpEpoch)
|
||||
sec := uint32(d / time.Second)
|
||||
frac := uint32(d % time.Second)
|
||||
return (uint64(sec) << 32) + (uint64(frac) << 32) / uint64(time.Second)
|
||||
return (uint64(sec) << 32) + (uint64(frac)<<32)/uint64(time.Second)
|
||||
}
|
||||
|
||||
@@ -21,15 +21,15 @@ func differs(a, b, delta uint64) bool {
|
||||
if a < b {
|
||||
a, b = b, a
|
||||
}
|
||||
return a - b >= delta
|
||||
return a-b >= delta
|
||||
}
|
||||
|
||||
func TestTime(t *testing.T) {
|
||||
a := Now(48000)
|
||||
time.Sleep(4 * time.Millisecond)
|
||||
b := Now(48000) - a
|
||||
if differs(b, 4 * 48, 16) {
|
||||
t.Errorf("Expected %v, got %v", 4 * 48, b)
|
||||
if differs(b, 4*48, 16) {
|
||||
t.Errorf("Expected %v, got %v", 4*48, b)
|
||||
}
|
||||
|
||||
c := Microseconds()
|
||||
@@ -68,7 +68,7 @@ func TestNTP(t *testing.T) {
|
||||
}
|
||||
if diff2 > (1 << 8) {
|
||||
t.Errorf("Expected %v, got %v (diff=%v)",
|
||||
ntp, ntp2, float64(diff2) / float64(1<<32))
|
||||
ntp, ntp2, float64(diff2)/float64(1<<32))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user