aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dis.c
diff options
context:
space:
mode:
authoralpartis <alpartis@thundernet.com>2016-05-06 07:57:42 -0400
committerMichael Mann <mmann78@netscape.net>2016-05-09 16:10:31 +0000
commitcb2627c77fad1e6f1f89d8ca1d0e216861d34dfa (patch)
tree4914ac3f300396ebc109a4a905fc88eff68f33d8 /epan/dissectors/packet-dis.c
parent8f58c02a4decd59d2cde7e5ce54760dfe45f5274 (diff)
format DIS header timestamp as mm:ss.nnnnnn
Older versions of this dissector displayed the header timestamp formatted to show minutes, seconds, and milliseconds past the hour (the DIS spec actually defines the timestamp in terms of microseconds). This commit fulfills a feature request to return to that format. Bug: 12402 Change-Id: Ide4adf8f80306f2458e48e8b2f78c911782669e5 Reviewed-on: https://code.wireshark.org/review/15276 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-dis.c')
-rw-r--r--epan/dissectors/packet-dis.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/epan/dissectors/packet-dis.c b/epan/dissectors/packet-dis.c
index c035876719..115d0e5951 100644
--- a/epan/dissectors/packet-dis.c
+++ b/epan/dissectors/packet-dis.c
@@ -6771,6 +6771,12 @@ static gint parseField_Timestamp(tvbuff_t *tvb, proto_tree *tree, gint offset, i
nstime_t tv;
proto_item* ti;
+ /* used in timestamp formatting for display */
+ guint minutes;
+ guint seconds;
+ guint micros;
+
+
offset = alignOffset(offset, 4);
/* convert to host value */
@@ -6784,7 +6790,16 @@ static gint parseField_Timestamp(tvbuff_t *tvb, proto_tree *tree, gint offset, i
tv.secs = (time_t)usec / 1000000;
tv.nsecs = (int)(usec % 1000000) * 1000;
- ti = proto_tree_add_time(tree, hf_relative, tvb, offset, 4, &tv);
+ /* in addition to the time value calculation, obtain values
+ * to use in display formatting. The time value is still
+ * needed to pass along -- these below values are strictly
+ * for display.
+ */
+ minutes = (guint)((usec / 1000000) / 60);
+ seconds = (guint)((usec - (minutes * 60 * 1000000)) / 1000000);
+ micros = (guint)(usec - (minutes * 60 * 1000000) - (seconds * 1000000));
+
+ ti = proto_tree_add_time_format_value(tree, hf_relative, tvb, offset, 4, &tv, "%02u:%02u.%06u", minutes, seconds, micros);
if (isAbsolute)
{