diff options
-rw-r--r-- | epan/dissectors/packet-time.c | 23 |
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 |