time in UNIX std, write binary to sink

nosocat
Jean-Louis Huynen 2019-01-11 09:31:28 +01:00
parent d6e85dc6db
commit 8e92187f01
1 changed files with 3 additions and 3 deletions

View File

@ -246,8 +246,8 @@ func (d4w *d4Writer) Write(bs []byte) (int, error) {
d4w.updateHeader(bs)
d4w.payload = bs
d4w.updateHMAC()
// Eventually write in the sink
d4w.w.Write(append(d4w.d4header, d4w.payload...))
// Eventually write binary in the sink
binary.Write(d4w.w, binary.LittleEndian, append(d4w.d4header, d4w.payload...))
return len(bs), nil
}
@ -255,7 +255,7 @@ func (d4w *d4Writer) Write(bs []byte) (int, error) {
func (d4w *d4Writer) updateHeader(bs []byte) bool {
// zero out moving parts
copy(d4w.d4header[18:], make([]byte, 44))
timeUnix := time.Now().UnixNano()
timeUnix := time.Now().Unix()
ps := 18
pe := ps + TIMESTAMP_SIZE
binary.LittleEndian.PutUint64(d4w.d4header[ps:pe], uint64(timeUnix))