aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/aristanetworks/goarista/monotime
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/aristanetworks/goarista/monotime')
-rw-r--r--vendor/github.com/aristanetworks/goarista/monotime/issue15006.s6
-rw-r--r--vendor/github.com/aristanetworks/goarista/monotime/nanotime.go24
2 files changed, 30 insertions, 0 deletions
diff --git a/vendor/github.com/aristanetworks/goarista/monotime/issue15006.s b/vendor/github.com/aristanetworks/goarista/monotime/issue15006.s
new file mode 100644
index 000000000..66109f4f3
--- /dev/null
+++ b/vendor/github.com/aristanetworks/goarista/monotime/issue15006.s
@@ -0,0 +1,6 @@
+// Copyright (C) 2016 Arista Networks, Inc.
+// Use of this source code is governed by the Apache License 2.0
+// that can be found in the COPYING file.
+
+// This file is intentionally empty.
+// It's a workaround for https://github.com/golang/go/issues/15006
diff --git a/vendor/github.com/aristanetworks/goarista/monotime/nanotime.go b/vendor/github.com/aristanetworks/goarista/monotime/nanotime.go
new file mode 100644
index 000000000..efc1b92a6
--- /dev/null
+++ b/vendor/github.com/aristanetworks/goarista/monotime/nanotime.go
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 Arista Networks, Inc.
+// Use of this source code is governed by the Apache License 2.0
+// that can be found in the COPYING file.
+
+// Package monotime provides a fast monotonic clock source.
+package monotime
+
+import (
+ _ "unsafe" // required to use //go:linkname
+)
+
+//go:noescape
+//go:linkname nanotime runtime.nanotime
+func nanotime() int64
+
+// Now returns the current time in nanoseconds from a monotonic clock.
+// The time returned is based on some arbitrary platform-specific point in the
+// past. The time returned is guaranteed to increase monotonically at a
+// constant rate, unlike time.Now() from the Go standard library, which may
+// slow down, speed up, jump forward or backward, due to NTP activity or leap
+// seconds.
+func Now() uint64 {
+ return uint64(nanotime())
+}