summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/tcpip.go
diff options
context:
space:
mode:
authorIan Gudger <igudger@google.com>2018-09-13 19:11:12 -0700
committerShentubot <shentubot@google.com>2018-09-13 19:12:15 -0700
commit29a7271f5da9fdb7b4a9a6c9ea61421ce6844a73 (patch)
tree6b6fe019f6459d36f50cdf47e406ccb0ae034f83 /pkg/tcpip/tcpip.go
parentbde2a91433cfbac426577a691bf13817115b53be (diff)
Plumb monotonic time to netstack
Netstack needs to be portable, so this seems to be preferable to using raw system calls. PiperOrigin-RevId: 212917409 Change-Id: I7b2073e7db4b4bf75300717ca23aea4c15be944c
Diffstat (limited to 'pkg/tcpip/tcpip.go')
-rw-r--r--pkg/tcpip/tcpip.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/pkg/tcpip/tcpip.go b/pkg/tcpip/tcpip.go
index 51360b11f..b1bd5117f 100644
--- a/pkg/tcpip/tcpip.go
+++ b/pkg/tcpip/tcpip.go
@@ -123,16 +123,11 @@ func (e ErrSaveRejection) Error() string {
// time, but never for netstack internal timekeeping.
type Clock interface {
// NowNanoseconds returns the current real time as a number of
- // nanoseconds since some epoch.
+ // nanoseconds since the Unix epoch.
NowNanoseconds() int64
-}
-
-// StdClock implements Clock with the time package.
-type StdClock struct{}
-// NowNanoseconds implements Clock.NowNanoseconds.
-func (*StdClock) NowNanoseconds() int64 {
- return time.Now().UnixNano()
+ // NowMonotonic returns a monotonic time value.
+ NowMonotonic() int64
}
// Address is a byte slice cast as a string that represents the address of a