aboutsummaryrefslogtreecommitdiffstats
path: root/tai64n
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-02-03 17:56:46 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-02-03 17:56:46 +0100
commit9c7bd73be2cc7b706d471cd34d718852457e8cef (patch)
tree08b0d4fea9027701805a05593e922afb4d8011a3 /tai64n
parentdevice: take peer handshake when reinitializing last sent handshake (diff)
downloadwireguard-go-9c7bd73be2cc7b706d471cd34d718852457e8cef.tar.xz
wireguard-go-9c7bd73be2cc7b706d471cd34d718852457e8cef.zip
tai64n: add string representation for error messages
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'tai64n')
-rw-r--r--tai64n/tai64n.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/tai64n/tai64n.go b/tai64n/tai64n.go
index 4f4ebab..e1fa26a 100644
--- a/tai64n/tai64n.go
+++ b/tai64n/tai64n.go
@@ -33,3 +33,7 @@ func Now() Timestamp {
func (t1 Timestamp) After(t2 Timestamp) bool {
return bytes.Compare(t1[:], t2[:]) > 0
}
+
+func (t Timestamp) String() string {
+ return time.Unix(int64(binary.BigEndian.Uint64(t[:8])-base), int64(binary.BigEndian.Uint32(t[8:12]))).String()
+}