aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2014-03-07 21:02:46 +0100
committerDaniel Willmann <daniel@totalueberwachung.de>2014-04-16 14:01:47 +0200
commit075e09f342c49f2bc23b600ad5a6d497596828d8 (patch)
tree4be5c09b526c60f67ff44a2bf68b7a1b24945cb0
parentcfe483853bc18e33a9a977a03e92e7cd6c8534e4 (diff)
sms: Fix support of negative timezone offsets in gsm340_gen_scts().
-rw-r--r--src/gsm/gsm0411_utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gsm/gsm0411_utils.c b/src/gsm/gsm0411_utils.c
index cdea5fc1..ad9753e6 100644
--- a/src/gsm/gsm0411_utils.c
+++ b/src/gsm/gsm0411_utils.c
@@ -84,7 +84,10 @@ void gsm340_gen_scts(uint8_t *scts, time_t time)
*scts++ = gsm411_bcdify(tm->tm_min);
*scts++ = gsm411_bcdify(tm->tm_sec);
#ifdef HAVE_TM_GMTOFF_IN_TM
- *scts++ = gsm411_bcdify(tm->tm_gmtoff/(60*15));
+ if (tm->tm_gmtoff >= 0)
+ *scts++ = gsm411_bcdify(tm->tm_gmtoff/(60*15));
+ else
+ *scts++ = gsm411_bcdify(-tm->tm_gmtoff/(60*15)) | 0x08;
#else
#warning find a portable way to obtain timezone offset
*scts++ = 0;