Patchwork [FIX,1/2] fixup! sms: Fix gsm340_scts() to correctly decode absolute valid times.

login
register
mail settings
Submitter Daniel Willmann
Date March 26, 2014, 9:44 p.m.
Message ID <02248a12c3e51d7e5f8b9ae9e3c54569b706e31a.1395869732.git.daniel@totalueberwachung.de>
Download mbox | patch
Permalink /patch/334117/
State New
Headers show

Comments

Daniel Willmann - March 26, 2014, 9:44 p.m.
---
 src/gsm/gsm0411_utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/src/gsm/gsm0411_utils.c b/src/gsm/gsm0411_utils.c
index 197f2c3..3052dd7 100644
--- a/src/gsm/gsm0411_utils.c
+++ b/src/gsm/gsm0411_utils.c
@@ -120,8 +120,8 @@  time_t gsm340_scts(uint8_t *scts)
 	/* according to gsm 03.40 time zone is
 	   "expressed in quarters of an hour" */
 	tz = *scts++;
-	ofs = gsm411_unbcdify(tz&0x7f) * 15*60;
-	if (tz&0x80)
+	ofs = gsm411_unbcdify(tz&0xf7) * 15*60;
+	if (tz&0x08)
 		ofs = -ofs;
 	/* mktime() doesn't take tm.tm_gmtoff into account. Instead, it fills this
 	 * field with the current timezone. Which means that the resulting time is