MSVC: compat: implement gmtime_r()

Technically, there's no need for gmtime_r() because Windows gmtime() is
thread-safe already, but we're using these thread-safe versions
almost everywhere already.
diff --git a/compat/compat.c b/compat/compat.c
index 1290cac..d11dbc2 100644
--- a/compat/compat.c
+++ b/compat/compat.c
@@ -290,6 +290,25 @@
 #endif
 #endif
 
+#ifndef HAVE_GMTIME_R
+#ifdef _WIN32
+struct tm *
+gmtime_r(const time_t *timep, struct tm *result)
+{
+    errno_t res = gmtime_s(result, timep);
+
+    if (res) {
+        return NULL;
+    } else {
+        return result;
+    }
+}
+
+#else
+#error No gmtime_r() implementation for this platform is available.
+#endif
+#endif
+
 #ifndef HAVE_DIRNAME
 #ifdef _WIN32
 #include <shlwapi.h>