tai64n: use proper nanoseconds offset

The code before was obviously wrong.

Reported-by: Vlad Krasnov <vlad@cloudflare.com>
This commit is contained in:
Jason A. Donenfeld 2018-11-08 03:58:01 +01:00
parent 276bf973e8
commit 4fd55daafe

View File

@ -20,7 +20,7 @@ func Now() Timestamp {
var tai64n Timestamp
now := time.Now()
secs := base + uint64(now.Unix())
nano := uint32(now.UnixNano())
nano := uint32(now.Nanosecond())
binary.BigEndian.PutUint64(tai64n[:], secs)
binary.BigEndian.PutUint32(tai64n[8:], nano)
return tai64n