logging: fix timestamp assumption micro -> nano (#253)

This commit is contained in:
Martin Kobetic 2022-06-06 10:58:11 -04:00 committed by GitHub
parent 4da7fea78a
commit c93cda7a95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -45,7 +45,7 @@ func HostID(key string, id peer.ID) zapcore.Field {
func (id hostID) String() string { return peer.Encode(peer.ID(id)) }
// Time - Waku uses Microsecond Unix Time
// Time - Waku uses Nanosecond Unix Time
type timestamp int64
// Time creates a field for Waku time value
@ -54,7 +54,7 @@ func Time(key string, time int64) zapcore.Field {
}
func (t timestamp) String() string {
return time.UnixMicro(int64(t)).Format(time.RFC3339)
return time.Unix(0, int64(t)).Format(time.RFC3339)
}
// History Query Filters
@ -96,8 +96,8 @@ func (pi *pagingInfo) MarshalLogObject(encoder zapcore.ObjectEncoder) error {
func (i *index) MarshalLogObject(encoder zapcore.ObjectEncoder) error {
encoder.AddBinary("digest", i.Digest)
encoder.AddTime("sent", time.UnixMicro(i.SenderTime))
encoder.AddTime("received", time.UnixMicro(i.ReceiverTime))
encoder.AddTime("sent", time.Unix(0, i.SenderTime))
encoder.AddTime("received", time.Unix(0, i.ReceiverTime))
return nil
}