timegm() is not avaliable on windows so we need a macro to abstract the
method. The windows implementation is simple using mktime() and
temporarily setting the timezone to GMT.
Signed-off-by: Mike Schonberg <mschonberg@...>
---
common/c_cpp/src/c/linux/port.h | 3 +++
mama/c_cpp/src/c/datetime.c | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/common/c_cpp/src/c/linux/port.h b/common/c_cpp/src/c/linux/port.h
index 86d6d2b..fc80ed9 100644
--- a/common/c_cpp/src/c/linux/port.h
+++ b/common/c_cpp/src/c/linux/port.h
@@ -163,6 +163,9 @@ int wsem_timedwait (wsem_t* sem, unsigned int ts);
#define wGetCurrentThreadId pthread_self
+/* time gm not available on Windows */
+#define wtimegm timegm
+
/* net work utility functions */
const char* getIpAddress (void);
const char* getHostName (void);
diff --git a/mama/c_cpp/src/c/datetime.c b/mama/c_cpp/src/c/datetime.c
index 3639fa6..1cb8cde 100644
--- a/mama/c_cpp/src/c/datetime.c
+++ b/mama/c_cpp/src/c/datetime.c
@@ -1653,7 +1653,7 @@ unsigned long makeTime (
timeInfo.tm_sec = sec;
timeInfo.tm_isdst = 0;
- return timegm (&timeInfo);
+ return wtimegm (&timeInfo);
}
void utcTm (
--
1.7.7.6