aboutsummaryrefslogtreecommitdiffstats
path: root/internal/tai64n
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2018-02-12 22:29:11 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2018-02-12 22:29:11 +0100
commitea4ea6f9334b8979bec6a881d7f94d7fa94e9b9c (patch)
treee939f1c2e4c09d871918a08e9646572e318e6cf1 /internal/tai64n
parentDon't use modules (diff)
downloadwireguard-go-ea4ea6f9334b8979bec6a881d7f94d7fa94e9b9c.tar.xz
wireguard-go-ea4ea6f9334b8979bec6a881d7f94d7fa94e9b9c.zip
Revert "Don't use modules"
This reverts commit bffe99aeadae09abd02f2bd3184925af6b680535.
Diffstat (limited to '')
-rw-r--r--internal/tai64n/tai64n.go (renamed from tai64n.go)4
-rw-r--r--internal/tai64n/tai64n_test.go (renamed from tai64n_test.go)6
2 files changed, 5 insertions, 5 deletions
diff --git a/tai64n.go b/internal/tai64n/tai64n.go
index 8c5ebe0..da5257c 100644
--- a/tai64n.go
+++ b/internal/tai64n/tai64n.go
@@ -1,4 +1,4 @@
-package main
+package tai64n
import (
"bytes"
@@ -11,7 +11,7 @@ const base = uint64(4611686018427387914)
type Timestamp [TimestampSize]byte
-func TimestampNow() Timestamp {
+func Now() Timestamp {
var tai64n Timestamp
now := time.Now()
secs := base + uint64(now.Unix())
diff --git a/tai64n_test.go b/internal/tai64n/tai64n_test.go
index a9e22b0..389b65c 100644
--- a/tai64n_test.go
+++ b/internal/tai64n/tai64n_test.go
@@ -1,4 +1,4 @@
-package main
+package tai64n
import (
"testing"
@@ -9,10 +9,10 @@ import (
* as used by WireGuard.
*/
func TestMonotonic(t *testing.T) {
- old := TimestampNow()
+ old := Now()
for i := 0; i < 10000; i++ {
time.Sleep(time.Nanosecond)
- next := TimestampNow()
+ next := Now()
if !next.After(old) {
t.Error("TAI64N, not monotonically increasing on nano-second scale")
}