Skip to content

Commit

Permalink
pyrdp: Use field description for formatted timestamp
Browse files Browse the repository at this point in the history
Same as other formats that use timestamps and makes it easier to use them in query,
number instead of a formatted string. Can still use todescription/0 to get
formatted timestamp.
  • Loading branch information
wader committed Jun 14, 2024
1 parent 52eaf10 commit 9db8226
Show file tree
Hide file tree
Showing 2 changed files with 378 additions and 383 deletions.
7 changes: 1 addition & 6 deletions format/pyrdp/pyrdp.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func decodePYRDP(d *decode.D) any {

size := d.FieldU64("size") // minus the length
pdu_type := uint16(d.FieldU16("pdu_type", pduTypesMap))
d.FieldU64("timestamp", timestampMapper)
d.FieldU64("timestamp", scalar.UintActualUnixTimeDescription(time.Millisecond, time.RFC3339Nano))
pdu_size := int64(size - 18)

pduParser, ok := pduParsersMap[pdu_type]
Expand Down Expand Up @@ -144,8 +144,3 @@ func decodePYRDP(d *decode.D) any {
}

func noParse(d *decode.D, length int64) {}

var timestampMapper = scalar.UintFn(func(s scalar.Uint) (scalar.Uint, error) {
s.Sym = time.UnixMilli(int64(s.Actual)).UTC().String()
return s, nil
})
Loading

0 comments on commit 9db8226

Please sign in to comment.