introduce HAVE_TM_GMTOFF_IN_TM
Not all architectures have the tm.tm_gmtoff member. This fixes cygwin
builds.
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index 20a2cc5..e596b21 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -29,6 +29,8 @@
#include <time.h>
#include <netinet/in.h>
+#include "bscconfig.h"
+
#include <openbsc/auth.h>
#include <openbsc/db.h>
#include <openbsc/debug.h>
@@ -734,7 +736,12 @@
/* Need to get GSM offset and convert into 15 min units */
/* This probably breaks if gmtoff returns a value not evenly divisible by 15? */
local_time = localtime(&cur_t);
+#ifdef HAVE_TM_GMTOFF_IN_TM
tzunits = (local_time->tm_gmtoff/60)/15;
+#else
+#warning find a portable way to obtain the timezone offset
+ tzunits = 0;
+#endif
if (tzunits < 0) {
tzunits = tzunits/-1;
ptr8[7] = bcdify(tzunits);
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index ee7f577..76c3720 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 @@
*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 @@
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);
}