Remove the MonotonicTime.Nanoseconds() accessor.

Updates #7338.

PiperOrigin-RevId: 448360987
This commit is contained in:
Nate Hurley
2022-05-12 16:15:15 -07:00
committed by gVisor bot
parent 7eec8dcf9a
commit e916e4fde3
3 changed files with 6 additions and 6 deletions
@@ -103,7 +103,7 @@ func Example() {
panic(fmt.Sprintf("table.GetLastUsedTimestamp(%#v) = (_, false)", routeKey))
}
fmt.Printf("Last used timestamp: %d", timestamp.Nanoseconds())
fmt.Printf("Last used timestamp: %s", timestamp)
// Finally, to remove an installed route, call:
if removed := table.RemoveInstalledRoute(routeKey); !removed {
@@ -452,8 +452,8 @@ func TestSetLastUsedTimestamp(t *testing.T) {
t.Fatalf("got table.GetLastUsedTimestamp(%#v) = (_, false_), want = (_, true)", defaultRouteKey)
}
if got, want := timestamp.Nanoseconds(), test.wantLastUsedTime.Nanoseconds(); got != want {
t.Errorf("got table.GetLastUsedTimestamp(%#v) = (%v, _), want (%v, _)", defaultRouteKey, got, want)
if timestamp != test.wantLastUsedTime {
t.Errorf("got table.GetLastUsedTimestamp(%#v) = (%s, _), want = (%s, _)", defaultRouteKey, timestamp, test.wantLastUsedTime)
}
})
}
+3 -3
View File
@@ -71,9 +71,9 @@ type MonotonicTime struct {
nanoseconds int64
}
// Nanoseconds returns the monotonic time in nanoseconds.
func (mt MonotonicTime) Nanoseconds() int64 {
return mt.nanoseconds
// String implements Stringer.
func (mt MonotonicTime) String() string {
return strconv.FormatInt(mt.nanoseconds, 10)
}
// Before reports whether the monotonic clock reading mt is before u.