mirror of
https://git.zx2c4.com/wireguard-go
synced 2024-11-15 01:05:15 +01:00
tai64n: use proper nanoseconds offset
The code before was obviously wrong. Reported-by: Vlad Krasnov <vlad@cloudflare.com>
This commit is contained in:
parent
276bf973e8
commit
4fd55daafe
@ -20,7 +20,7 @@ func Now() Timestamp {
|
|||||||
var tai64n Timestamp
|
var tai64n Timestamp
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
secs := base + uint64(now.Unix())
|
secs := base + uint64(now.Unix())
|
||||||
nano := uint32(now.UnixNano())
|
nano := uint32(now.Nanosecond())
|
||||||
binary.BigEndian.PutUint64(tai64n[:], secs)
|
binary.BigEndian.PutUint64(tai64n[:], secs)
|
||||||
binary.BigEndian.PutUint32(tai64n[8:], nano)
|
binary.BigEndian.PutUint32(tai64n[8:], nano)
|
||||||
return tai64n
|
return tai64n
|
||||||
|
Loading…
Reference in New Issue
Block a user