aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dis.c
diff options
context:
space:
mode:
authoralpartis <alpartis@thundernet.com>2016-01-11 23:49:30 -0500
committerAnders Broman <a.broman58@gmail.com>2016-01-14 05:31:18 +0000
commit0a0acd9aaabcab88ca0d19783dcec443c3c3c625 (patch)
tree20d906c3239eb56901140788ab80b57ae4637d18 /epan/dissectors/packet-dis.c
parentd1ab1590cfb8f1652492684df97f6906903b8715 (diff)
Present PDU header timestamps with microsecond resolution as exists in packet data.
On behalf of SimPhonics, Inc. IEEE 1278.1-2012 DIS spec details the PDU header timestamp in section 6.2.88 as a 31-bit unsigned integer count of microseconds since the start of the current interval. Likewise, the DIS dissector should reflect this information accurately, based on the actual complete contents of captured packets. Tested with DIS packets generated from VPlus for radio simulation by SimPhonics. Change-Id: I73b9689e1fb35900b7063746cac604a72a69ab16 Reviewed-on: https://code.wireshark.org/review/13210 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-dis.c')
-rw-r--r--epan/dissectors/packet-dis.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/epan/dissectors/packet-dis.c b/epan/dissectors/packet-dis.c
index fb9f4ca0a2..50c4edb624 100644
--- a/epan/dissectors/packet-dis.c
+++ b/epan/dissectors/packet-dis.c
@@ -6683,16 +6683,16 @@ static gint alignOffset(gint offset, guint fieldLength)
return offset;
}
-/* Parse the Timestamp */
+/* Parse the Timestamp -- defined in spec in microsecods: DIS 1278.1-2012: sec 5.2.5, detailed in sec 6.2.88 */
static gint parseField_Timestamp(tvbuff_t *tvb, proto_tree *tree, gint offset, int hf_relative)
{
/* some consts */
- static guint MSEC_PER_HOUR = 60 * 60 * 1000;
+ static guint USEC_PER_HOUR = (guint)3600 * (guint)1000000;
static guint FSV = 0x7fffffff; /* 2^31-1 */
/* variables */
guint isAbsolute = 0;
guint32 uintVal;
- guint64 ms;
+ guint64 usec;
nstime_t tv;
proto_item* ti;
@@ -6703,11 +6703,11 @@ static gint parseField_Timestamp(tvbuff_t *tvb, proto_tree *tree, gint offset, i
/* determine absolute vis sim time */
isAbsolute = uintVal & 1;
- /* convert TS to MS */
- ms = (guint64)((uintVal >> 1) * (double)(MSEC_PER_HOUR) / FSV);
+ /* convert TS to uSec */
+ usec = (guint64)((uintVal >> 1) * (double)(USEC_PER_HOUR) / FSV);
- tv.secs = (time_t)ms/1000;
- tv.nsecs = (int)(ms%1000)*1000000;
+ tv.secs = (time_t)usec / 1000000;
+ tv.nsecs = (int)(usec % 1000000) * 1000;
ti = proto_tree_add_time(tree, hf_relative, tvb, offset, 4, &tv);