summaryrefslogtreecommitdiffhomepage
path: root/tstime/monocoarse_std.go
diff options
context:
space:
mode:
Diffstat (limited to 'tstime/monocoarse_std.go')
-rw-r--r--tstime/monocoarse_std.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/tstime/monocoarse_std.go b/tstime/monocoarse_std.go
index 8a289dcee..24630e167 100644
--- a/tstime/monocoarse_std.go
+++ b/tstime/monocoarse_std.go
@@ -14,3 +14,12 @@ var referenceTime = time.Now()
func MonotonicCoarse() int64 {
return int64(time.Since(referenceTime).Seconds())
}
+
+// Monotonic returns the number of monotonic seconds elapsed
+// since an unspecified starting point, at low precision.
+// It is only meaningful when compared to the
+// result of previous MonotonicCoarse calls.
+// On some platforms, MonotonicCoarse is much faster than time.Now.
+func Monotonic() int64 {
+ return int64(time.Since(referenceTime).Seconds())
+}