From: wmeier Date: Fri, 16 Apr 2010 19:27:56 +0000 (+0000) Subject: From Marcus Renz: Fix for "PTP dissector displays big correction field values wrong" X-Git-Url: http://git.samba.org/samba.git/?p=obnox%2Fwireshark%2Fwip.git;a=commitdiff_plain;h=3ef7e4f20dff49f65e3f53c83a51531b6f51f0aa From Marcus Renz: Fix for "PTP dissector displays big correction field values wrong" See: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4635 git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@32499 f5534014-38df-0310-8fa8-9805f1628bb7 --- diff --git a/AUTHORS b/AUTHORS index 1c4c2c642d..99f637b7ed 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3196,6 +3196,7 @@ Hilko Bengen Hadar Shoham Robert Bullen Chuck Kristofek +Markus Renz Alain Magloire was kind enough to give his permission to use his version of snprintf.c. diff --git a/epan/dissectors/packet-ptp.c b/epan/dissectors/packet-ptp.c index b355c63cef..149ed45ff6 100644 --- a/epan/dissectors/packet-ptp.c +++ b/epan/dissectors/packet-ptp.c @@ -2172,24 +2172,11 @@ dissect_ptp_v2_timeInterval(tvbuff_t *tvb, guint16 *cur_offset, proto_tree *tree proto_item *ptptimeInterval_ti; proto_tree *ptptimeInterval_subtree; - time_ns = tvb_get_ntohl(tvb, *cur_offset); - + time_ns = tvb_get_ntoh64(tvb, *cur_offset); + time_double = (1.0*time_ns) / 65536.0; + time_ns = time_ns >> 16; time_subns = tvb_get_ntohs(tvb, *cur_offset+6); - time_ns = time_ns << 16; - - if(time_ns & 0x800000){ - time_ns = time_ns | G_GINT64_CONSTANT(0xFFFFFFFFFF000000); - time_ns = time_ns | tvb_get_ntohs(tvb, *cur_offset+4); - - time_double = ((1.0*time_ns) + (time_subns/65536.0)); - } - else - { - time_ns = time_ns | tvb_get_ntohs(tvb, *cur_offset+4); - time_double = time_ns + (time_subns/65536.0); - } - ptptimeInterval_ti = proto_tree_add_text(tree, tvb, *cur_offset, 8, "%s: %f nanoseconds", name, time_double);