From fbc780001a7410fa48b7f0de74f0b9f237a55823 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 25 Mar 2015 00:38:46 +0100 Subject: [PATCH] Compare the expected date in a local timezone --- tests/pdu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/pdu.c b/tests/pdu.c index b61f955..dfd9f6f 100644 --- a/tests/pdu.c +++ b/tests/pdu.c @@ -41,7 +41,7 @@ static int _pdu(void) return _pdu_decode("07916407058099F9040B916407752743" "F60000990121017580001554747A0E4A" "CF416110945805B5CBF379F85C06", - "+46705772346", "12/10/1999 11:57:08", + "+46705772346", "12/10/1999 12:57:08", MODEM_MESSAGE_ENCODING_UTF8, "This is a PDU message"); } @@ -59,6 +59,7 @@ static int _pdu_decode(char const * pdu, char const * number, char * p; struct tm t; size_t len; + timezone_t tz; if((p = _cmgr_pdu_parse(pdu, ×tamp, buf, &e, &len)) == NULL) { @@ -72,7 +73,9 @@ static int _pdu_decode(char const * pdu, char const * number, ret = 1; } /* check the timestamp */ - localtime_r(×tamp, &t); + tz = tzalloc("Europe/Berlin"); + localtime_rz(tz, ×tamp, &t); + tzfree(tz); strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M:%S", &t); if(strcmp(buf, datetime) != 0) {