chiark / gitweb /
configure.ac: Use Automake `silent-rules' by default.
[disorder] / lib / xgetdate.c
index d3a3862c05725b3d1fd4a609adb40fba70c80bf9..81472f1246c87e473dc16e8f34689b69b3d291a3 100644 (file)
@@ -35,6 +35,7 @@
 #include <time.h>
 
 #include "dateparse.h"
+#include "strptime.h"
 
 #define TM_YEAR_BASE 1900
 
@@ -118,23 +119,23 @@ xgetdate_r (const char *string, struct tm *tp,
            const char *const *template)
 {
   const char *line;
-  size_t len;
   char *result = NULL;
   time_t timer;
   struct tm tm;
   int mday_ok = 0;
 
   line = NULL;
-  len = 0;
   while((line = *template++))
     {
       /* Do the conversion.  */
       tp->tm_year = tp->tm_mon = tp->tm_mday = tp->tm_wday = INT_MIN;
       tp->tm_hour = tp->tm_sec = tp->tm_min = INT_MIN;
       tp->tm_isdst = -1;
+#if !_WIN32
       tp->tm_gmtoff = 0;
       tp->tm_zone = NULL;
-      result = strptime (string, line, tp);
+#endif
+      result = my_strptime (string, line, tp);
       if (result && *result == '\0')
        break;
     }
@@ -144,7 +145,11 @@ xgetdate_r (const char *string, struct tm *tp,
 
   /* Get current time.  */
   time (&timer);
-  localtime_r (&timer, &tm);
+#if _WIN32
+  localtime_s(&tm, &timer);
+#else
+  localtime_r(&timer, &tm);
+#endif
 
   /* If only the weekday is given, today is assumed if the given day
      is equal to the current day and next week if it is less.  */