diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2012-01-27 22:59:25 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2012-01-27 22:59:25 +0000 |
commit | 98d51466e54a778506addee39bf7f005e65f68ec (patch) | |
tree | c00e26bca107119ffbffe3df4388e3eea5838c51 /epan/dissectors/packet-smpp.c | |
parent | d307494e07b394119fcf0a01f8fc3dcec754cdaf (diff) |
Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6712 :
Since SMPP knows the time zone of its (absolute) times and since we don't
have access to a mktime() routine that doesn't take into account the local
time zone (and since I don't think repeatedly setting the TZ environment
variable is a healthy choice):
1) subtract the 'timezone' (or '_timezone' on Windows) back out after calling
mktime()
2) then adjust the time to take into the protocol-specified time zone
3) and (finally) display the time in UTC (since we don't have the
infrastructure to display it in the protocol-specified time zone).
(I *think* (1) is portable: POSIX says that variable should exist...)
svn path=/trunk/; revision=40742
Diffstat (limited to 'epan/dissectors/packet-smpp.c')
-rw-r--r-- | epan/dissectors/packet-smpp.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/epan/dissectors/packet-smpp.c b/epan/dissectors/packet-smpp.c index aec19d2f83..09010f7b0c 100644 --- a/epan/dissectors/packet-smpp.c +++ b/epan/dissectors/packet-smpp.c @@ -1167,6 +1167,14 @@ smpp_mktime(const char *datestr, time_t *secs, int *nsecs) if (relative == FALSE) { *secs = mktime(&r_time); + /* Subtract out the timezone information since we will adjust for + * timezone below and then display in UTC. + */ +#ifdef _WIN32 + *secs -= _timezone; +#else + *secs -= timezone; +#endif *nsecs = (datestr[12] - '0') * 100000000; t_diff = (10 * (datestr[13] - '0') + (datestr[14] - '0')) * 900; if (datestr[15] == '+') @@ -2865,7 +2873,7 @@ proto_register_smpp(void) }, { &hf_smpp_schedule_delivery_time, { "Scheduled delivery time", "smpp.schedule_delivery_time", - FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x00, + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x00, "Scheduled time for delivery of short message.", HFILL } @@ -2879,7 +2887,7 @@ proto_register_smpp(void) }, { &hf_smpp_validity_period, { "Validity period", "smpp.validity_period", - FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x00, + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x00, "Validity period of this message.", HFILL } @@ -2977,7 +2985,7 @@ proto_register_smpp(void) }, { &hf_smpp_final_date, { "Final date", "smpp.final_date", - FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x00, + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x00, "Date-time when the queried message reached a final state.", HFILL } @@ -3619,7 +3627,7 @@ proto_register_smpp(void) }, { &hf_smpp_broadcast_end_time, { "Broadcast Message - End Time", "smpp.broadcast_end_time", - FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x00, + FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x00, "Cell Broadcast Message - Date and time at which MC set the state of the message to terminated", HFILL } }, |