aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-smpp.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2016-10-11 21:58:29 +0200
committerAnders Broman <a.broman58@gmail.com>2016-10-12 03:50:28 +0000
commitaa78460ef9793ea56f79ef353e9f6af3805799f8 (patch)
tree0a064018ca1a57ef05b4200e77d6e74a51147beb /epan/dissectors/packet-smpp.c
parent50ddeaadf9fa300858a0b02cf451ade5ce443d98 (diff)
SMPP: use mktime_utc to convert struct tm to time_t
Bug: 12632 Change-Id: Ie340facff86d988b7a85f6351d85343169042ce9 Reviewed-on: https://code.wireshark.org/review/18155 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-smpp.c')
-rw-r--r--epan/dissectors/packet-smpp.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/epan/dissectors/packet-smpp.c b/epan/dissectors/packet-smpp.c
index 7f80206a09..a711ee1700 100644
--- a/epan/dissectors/packet-smpp.c
+++ b/epan/dissectors/packet-smpp.c
@@ -54,8 +54,8 @@
#include <epan/packet.h>
#include <epan/exceptions.h>
#include <epan/stats_tree.h>
-
#include <epan/prefs.h>
+#include <wsutil/time_util.h>
#include "packet-tcp.h"
#include "packet-smpp.h"
@@ -1174,10 +1174,7 @@ smpp_mktime(const char *datestr, time_t *secs, int *nsecs)
r_time.tm_isdst = -1;
if (relative == FALSE) {
- struct tm *gm, *local_time;
- int gm_hour, gm_min;
-
- *secs = mktime(&r_time);
+ *secs = mktime_utc(&r_time);
*nsecs = 0;
if (*secs == (time_t)(-1)) {
return relative;
@@ -1191,27 +1188,6 @@ smpp_mktime(const char *datestr, time_t *secs, int *nsecs)
else if (datestr[15] == '+')
/* Represented time is ahead of UTC, shift it backward to UTC */
*secs -= t_diff;
-
- /* Subtract out the timezone information since we adjusted for
- * the presented time's timezone above and will display in UTC.
- *
- * To do that, first determine how the time is represented in the
- * local time zone and in UTC.
- */
- if (((gm = gmtime(secs)) == NULL) || ((local_time = localtime(secs)) == NULL)) {
- *secs = (time_t)(-1);
- *nsecs = 0;
- return relative;
- }
-
- gm_hour = gm->tm_hour;
- gm_min = gm->tm_min;
- /* Then subtract out the difference between those times (whether the
- * difference is measured in hours, minutes, or both).
- */
- *secs -= 3600*(gm_hour - local_time->tm_hour);
- *secs -= 60*(gm_min - local_time->tm_min);
-
} else {
*secs = r_time.tm_sec + 60 *
(r_time.tm_min + 60 *