+#else
+
+#if defined(__MINGW32__) && CYGWIN_VERSION_DLL_MAJOR <= 21
+#define LowPart u.LowPart
+#define HighPart u.HighPart
+#endif
+
+static LARGE_INTEGER utc_base_li;
+
+time_t
+convert_time (FILETIME uft)
+{
+ time_t ret;
+#ifndef MAXLONGLONG
+ SYSTEMTIME st;
+ struct tm t;
+ FILETIME ft;
+ TIME_ZONE_INFORMATION tzi;
+ DWORD tzid;
+#else
+ LARGE_INTEGER lft;
+#endif
+
+ if (!init)
+ {
+ /* Determine the delta between 1-Jan-1601 and 1-Jan-1970. */
+ SYSTEMTIME st;
+
+ st.wYear = 1970;
+ st.wMonth = 1;
+ st.wDay = 1;
+ st.wHour = 0;
+ st.wMinute = 0;
+ st.wSecond = 0;
+ st.wMilliseconds = 0;
+
+ SystemTimeToFileTime (&st, &utc_base_ft);
+
+ utc_base_li.LowPart = utc_base_ft.dwLowDateTime;
+ utc_base_li.HighPart = utc_base_ft.dwHighDateTime;
+
+ init = 1;
+ }
+
+#ifdef MAXLONGLONG
+
+ /* On a compiler that supports long integers, do it the easy way */
+ lft.LowPart = uft.dwLowDateTime;
+ lft.HighPart = uft.dwHighDateTime;
+ ret = (time_t) ((lft.QuadPart - utc_base_li.QuadPart) / 10000000);
+
+#else
+
+ /* Do it the hard way using mktime. */
+ FileTimeToLocalFileTime(&uft, &ft);
+ FileTimeToSystemTime (&ft, &st);
+ tzid = GetTimeZoneInformation (&tzi);
+ t.tm_year = st.wYear - 1900;
+ t.tm_mon = st.wMonth - 1;
+ t.tm_mday = st.wDay;
+ t.tm_hour = st.wHour;
+ t.tm_min = st.wMinute;
+ t.tm_sec = st.wSecond;
+ t.tm_isdst = (tzid == TIME_ZONE_ID_DAYLIGHT);
+ /* st.wMilliseconds not applicable */
+ ret = mktime(&t);
+ if (ret == -1)
+ {
+ ret = 0;
+ }
+
+#endif
+
+ return ret;
+}
+#endif
+#if defined(__MINGW32__) && CYGWIN_VERSION_DLL_MAJOR <= 21
+#undef LowPart
+#undef HighPart
+#endif