summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/gsm_04_11.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-04-08 16:59:24 +0200
committerHarald Welte <laforge@gnumonks.org>2012-04-08 16:59:24 +0200
commit9c3dc90d16a40789081c84e46620f4d66689fec1 (patch)
tree69fba13dafd13f1429b8539cba097ea18d2beb10 /openbsc/src/libmsc/gsm_04_11.c
parenta334c296e02852880148abf92abf12c63ed49b3b (diff)
introduce HAVE_TM_GMTOFF_IN_TM
Not all architectures have the tm.tm_gmtoff member. This fixes cygwin builds.
Diffstat (limited to 'openbsc/src/libmsc/gsm_04_11.c')
-rw-r--r--openbsc/src/libmsc/gsm_04_11.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index ee7f5772c..76c37208b 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -32,6 +32,8 @@
#include <time.h>
#include <netinet/in.h>
+#include "bscconfig.h"
+
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/tlv.h>
#include <openbsc/debug.h>
@@ -279,7 +281,12 @@ static void gsm340_gen_scts(uint8_t *scts, time_t time)
*scts++ = bcdify(tm->tm_hour);
*scts++ = bcdify(tm->tm_min);
*scts++ = bcdify(tm->tm_sec);
+#ifdef HAVE_TM_GMTOFF_IN_TM
*scts++ = bcdify(tm->tm_gmtoff/(60*15));
+#else
+#warning find a portable way to obtain timezone offset
+ *scts++ = 0;
+#endif
}
/* Decode 03.40 TP-SCTS (into utc/gmt timestamp) */
@@ -300,7 +307,9 @@ static time_t gsm340_scts(uint8_t *scts)
tm.tm_sec = unbcdify(*scts++);
/* according to gsm 03.40 time zone is
"expressed in quarters of an hour" */
+#ifdef HAVE_TM_GMTOFF_IN_TM
tm.tm_gmtoff = unbcdify(*scts++) * 15*60;
+#endif
return mktime(&tm);
}