aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-time.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2011-07-05 15:22:28 +0000
committerAnders Broman <anders.broman@ericsson.com>2011-07-05 15:22:28 +0000
commit1103e61a2adbf2ca3b3cab8ba780c68f1c9ee601 (patch)
tree887ed1c50473bf1576699264b678da0f346e96f7 /epan/dissectors/packet-time.c
parent9e5a06a2effe7f8f17b51cf996f7410ae16e960a (diff)
From Michael Mann:
Added choice to display UTC or local time. Defaulted to local for "backwards compatibility" https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3384 svn path=/trunk/; revision=37902
Diffstat (limited to 'epan/dissectors/packet-time.c')
-rw-r--r--epan/dissectors/packet-time.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/epan/dissectors/packet-time.c b/epan/dissectors/packet-time.c
index 963f1202e3..4b37164f15 100644
--- a/epan/dissectors/packet-time.c
+++ b/epan/dissectors/packet-time.c
@@ -31,11 +31,20 @@
#endif
#include <epan/packet.h>
+#include <epan/prefs.h>
+
+
+static enum_val_t time_display_types[] = {
+ { "UTC", "UTC", ABSOLUTE_TIME_UTC },
+ { "Local", "Local", ABSOLUTE_TIME_LOCAL},
+ { NULL, NULL, 0 }
+};
static int proto_time = -1;
static int hf_time_time = -1;
static gint ett_time = -1;
+static gint time_display_type = ABSOLUTE_TIME_LOCAL;
/* This dissector works for TCP and UDP time packets */
#define TIME_PORT 37
@@ -65,7 +74,7 @@ dissect_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 delta_seconds = tvb_get_ntohl(tvb, 0);
proto_tree_add_uint_format(time_tree, hf_time_time, tvb, 0, 4,
delta_seconds, "%s",
- abs_time_secs_to_str(delta_seconds-2208988800U, ABSOLUTE_TIME_LOCAL, TRUE));
+ abs_time_secs_to_str(delta_seconds-2208988800U, time_display_type, TRUE));
}
}
}
@@ -84,9 +93,21 @@ proto_register_time(void)
&ett_time,
};
+ module_t *time_pref ;
+
proto_time = proto_register_protocol("Time Protocol", "TIME", "time");
proto_register_field_array(proto_time, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+
+ time_pref = prefs_register_protocol(proto_time, NULL);
+ prefs_register_enum_preference(time_pref,
+ "display_time_type",
+ "Time Display",
+ "Time display type",
+ &time_display_type,
+ time_display_types,
+ FALSE);
+
}
void