From 4a77835dc690606790f169b45060f1c0667a01cf Mon Sep 17 00:00:00 2001 From: pinkfish Date: Fri, 22 Sep 2023 17:14:06 -0700 Subject: [PATCH] Update write.go Change the time comparison to use Equal, which is safer with timestamps in go. Use IsZero() --- write.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/write.go b/write.go index d0011f8..dcec314 100644 --- a/write.go +++ b/write.go @@ -72,7 +72,6 @@ func (f *heartbeatFrame) write(w io.Writer) (err error) { // short short long long short remainder... func (f *headerFrame) write(w io.Writer) (err error) { var payload bytes.Buffer - var zeroTime time.Time if err = binary.Write(&payload, binary.BigEndian, f.ClassId); err != nil { return @@ -118,7 +117,7 @@ func (f *headerFrame) write(w io.Writer) (err error) { if len(f.Properties.MessageId) > 0 { mask = mask | flagMessageId } - if f.Properties.Timestamp != zeroTime { + if !f.Properties.Timestamp.IsZero() { mask = mask | flagTimestamp } if len(f.Properties.Type) > 0 {