diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-02-03 17:56:46 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-02-03 17:56:46 +0100 |
commit | 9c7bd73be2cc7b706d471cd34d718852457e8cef (patch) | |
tree | 08b0d4fea9027701805a05593e922afb4d8011a3 | |
parent | 01e176af3c2b36c7da3bfd8f92f7f578ecd4fbd6 (diff) |
tai64n: add string representation for error messages
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | tai64n/tai64n.go | 4 |
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() +} |