diff options
author | Michael Mann <mmann78@netscape.net> | 2016-12-12 13:22:05 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-12-13 22:56:36 +0000 |
commit | a869ec6f55160622a90bc437517dee91d57f85d5 (patch) | |
tree | ea55cf7ba5f820af87e01d2a28d38d6b6ebe547e /epan/dissectors/packet-ptp.c | |
parent | e150235ef14cf6a9ada7d74c534e4aee469f3ac5 (diff) |
Adjust proto_tree_add_[float|double]_format_value calls to use unit string
Several calls to proto_tree_add_[float|double]_xxx could be better served
using BASE_UNIT_STRING with a "unit string" in hf_ field.
Added a few more "common" unit string values to unit_strings.[ch]
Change-Id: Id0da7b579403898d20c2667d6c4abcd59d5a48d4
Reviewed-on: https://code.wireshark.org/review/19241
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-ptp.c')
-rw-r--r-- | epan/dissectors/packet-ptp.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/epan/dissectors/packet-ptp.c b/epan/dissectors/packet-ptp.c index 117e554261..8e9bb12603 100644 --- a/epan/dissectors/packet-ptp.c +++ b/epan/dissectors/packet-ptp.c @@ -2403,9 +2403,8 @@ dissect_ptp_v2_timeInterval(tvbuff_t *tvb, guint16 *cur_offset, proto_tree *tree proto_tree_add_uint64_format_value(ptptimeInterval_subtree, hf_ptp_v2_timeInterval_ns, tvb, *cur_offset, 6, time_ns, "Ns: %" G_GINT64_MODIFIER "d nanoseconds", time_ns); - proto_tree_add_double_format_value(ptptimeInterval_subtree, - hf_ptp_v2_timeInterval_subns, tvb, *cur_offset+6, 2, (time_subns/65536.0), - "%f nanoseconds", (time_subns/65536.0)); + proto_tree_add_double(ptptimeInterval_subtree, + hf_ptp_v2_timeInterval_subns, tvb, *cur_offset+6, 2, (time_subns/65536.0)); *cur_offset = *cur_offset + 8; } @@ -5032,7 +5031,7 @@ proto_register_ptp(void) }, { &hf_ptp_v2_correctionsubns, { "correctionSubNs", "ptp.v2.correction.subns", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_nanosecond_nanoseconds, 0x00, NULL, HFILL } }, { &hf_ptp_v2_clockidentity, @@ -5933,7 +5932,7 @@ proto_register_ptp(void) }, { &hf_ptp_v2_mm_offset_subns, { "SubNs", "ptp.v2.mm.offset.subns", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_nanosecond_nanoseconds, 0x00, NULL, HFILL } }, { &hf_ptp_v2_mm_pathDelay_ns, @@ -5943,7 +5942,7 @@ proto_register_ptp(void) }, { &hf_ptp_v2_mm_pathDelay_subns, { "SubNs", "ptp.v2.mm.pathDelay.subns", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_nanosecond_nanoseconds, 0x00, NULL, HFILL } }, { &hf_ptp_v2_mm_PortNumber, @@ -5968,7 +5967,7 @@ proto_register_ptp(void) }, { &hf_ptp_v2_mm_peerMeanPathDelay_subns, { "SubNs", "ptp.v2.mm.peerMeanPathDelay.subns", - FT_DOUBLE, BASE_NONE, NULL, 0x00, + FT_DOUBLE, BASE_NONE|BASE_UNIT_STRING, &units_nanosecond_nanoseconds, 0x00, NULL, HFILL } }, { &hf_ptp_v2_mm_logAnnounceInterval, |