Wireshark mailing list archives
Re: formatted time in dissector
From: Michael Mann <mmann78 () netscape net>
Date: Fri, 6 May 2016 10:40:18 -0400
I thought one of the other reasons Jaap's suggestion is good is that when you try to filter with that field, you will get your desired format as the filter text. Right now the field displays as "mm:ss.nnnnnn" in the packet details, but will still show up as "ssss.nnnnnnnnn" if you try to filter on it. -----Original Message----- From: Jaap Keuter <jaap.keuter () xs4all nl> To: Developer support list for Wireshark <wireshark-dev () wireshark org> Sent: Fri, May 6, 2016 2:18 am Subject: Re: [Wireshark-dev] formatted time in dissector Hi, You've done this the right ways, for a single instance representation. If this is a representation that would be needed more often (as in, is commonly used in various dissectors) it can be added to the ftypes system (see epan/ftypes), in this case ftype-time.c. I could image it being handled via a new FIELDDISPLAY for FIELDTYPE FT_RELATIVE_TIME. Thanks, Jaap On 06-05-16 01:59, Alan Partis wrote:
In the DIS dissector (packet-dis.c), I have constructed an nstime_t var and populated its .secs and .nsecs fields with calculated values from the protocol buffer. I'd like to have this display in the packet dissection pane in so-called formatted time i.e. "mm:ss.nnnnnn" where 'nnnnnn' displays to microsecond accuracy. Right now, the dissector simply calls proto_tree_add_time() and the time is displayed as a number of seconds with nanoseconds i.e. "ssss.nnnnnnnnn" with the final 3 digits always showing '000' (because the nstime_t structure only hold a microsecond accuracy). To achieve what I want, I've changed the dissector to instead call proto_tree_add_time_format_value(..., "%02u:%02u.%06u", mm, ss, usec); While that produces the desired result, it doesn't feel quite right to me. Is there another way to get a proto_tree_add_time_xxx() function to print automagically the format I want? Or did I actually do it right in the first place? Thanks. _______________________________________________________ Alan Partis thundernet development group
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: https://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: https://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- formatted time in dissector Alan Partis (May 05)
- Re: formatted time in dissector Jaap Keuter (May 05)
- Re: formatted time in dissector Michael Mann (May 06)
- Re: formatted time in dissector Jaap Keuter (May 05)