Avoid depending on the presence of tm_gmtoff to calculate the gmt
offset.
---
 src/gsm/gsm0411_utils.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gsm/gsm0411_utils.c b/src/gsm/gsm0411_utils.c
index c6d68bd..94d48fd 100644
--- a/src/gsm/gsm0411_utils.c
+++ b/src/gsm/gsm0411_utils.c
@@ -119,7 +119,7 @@ time_t gsm340_scts(uint8_t *scts)
        struct tm tm;
        uint8_t yr, tz;
        int ofs;
-       time_t timestamp;
+       time_t timestamp, gmtoffset;
 
        memset(&tm, 0x00, sizeof(struct tm));
 
@@ -151,12 +151,12 @@ time_t gsm340_scts(uint8_t *scts)
        if (timestamp < 0)
                return -1;
 
+       gmtoffset = gmtoffset_from_ts(timestamp);
+
        /* Take into account timezone offset */
        timestamp -= ofs;
-#ifdef HAVE_TM_GMTOFF_IN_TM
        /* Remove an artificial timezone offset, introduced by mktime() */
-       timestamp += tm.tm_gmtoff;
-#endif
+       timestamp += gmtoffset;
 
        return timestamp;
 }
-- 
1.8.4.2


Reply via email to