diff options
author | Alexander Chemeris <Alexander.Chemeris@gmail.com> | 2014-03-07 21:02:46 +0100 |
---|---|---|
committer | Alexander Chemeris <Alexander.Chemeris@gmail.com> | 2014-03-16 15:08:54 +0400 |
commit | 7fb5e2de4b8a582cbfd9ab1f00e0db1402145fc3 (patch) | |
tree | 3c4a176d73876a951fd4ad0823132e8f953ac1bf | |
parent | 36d0feee3abdd6c8d2f645c11e026fcf828224ea (diff) |
sms: Fix support of negative timezone offsets in gsm340_gen_scts().
-rw-r--r-- | src/gsm/gsm0411_utils.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gsm/gsm0411_utils.c b/src/gsm/gsm0411_utils.c index b4b51163..bb59a10d 100644 --- a/src/gsm/gsm0411_utils.c +++ b/src/gsm/gsm0411_utils.c @@ -86,7 +86,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)) | 0x80; #else #warning find a portable way to obtain timezone offset *scts++ = 0; |