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
This commit is contained in:
Anders Broman 2011-07-05 15:22:28 +00:00
parent 9e5a06a2ef
commit 1103e61a2a
1 changed files with 22 additions and 1 deletions

View File

@ -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