# HG changeset patch
# User Edouard Tisserant
# Date 1354071123 -32400
# Node ID bca119630cf66afb2e8c2bbe68478d3893ceb29e
# Parent  6cc8255ecfe4d8804518cb43cccac6c6fbc70856
Fixed timegm usage incompatible with mingw, reverted to mktime in case mingw is detected

diff -r 6cc8255ecfe4 -r bca119630cf6 lib/iec_std_lib.h
--- a/lib/iec_std_lib.h	Fri Nov 16 01:02:54 2012 +0100
+++ b/lib/iec_std_lib.h	Wed Nov 28 11:52:03 2012 +0900
@@ -224,6 +224,12 @@
   return ts;
 }
 
+#ifdef __MINGW32__
+#define TIMEGM mktime
+#else
+#define TIMEGM timegm
+#endif
+
 static inline IEC_TIMESPEC __date_to_timespec(int day, int month, int year) {
   IEC_TIMESPEC ts;
   struct tm broken_down_time;
@@ -237,7 +243,7 @@
   broken_down_time.tm_year = year - 1900;  /* number of years since 1900 */
   broken_down_time.tm_isdst = -1; /* disable daylight savings time */
   
-  epoch_seconds = timegm(&broken_down_time); /* determine number of seconds since the epoch, i.e. Jan 1st 1970 */
+  epoch_seconds = TIMEGM(&broken_down_time); /* determine number of seconds since the epoch, i.e. Jan 1st 1970 */
 
   if ((time_t)(-1) == epoch_seconds)
     __iec_error();