compat: implement gmtime_r() function for MSVS
On Windows, we do not have gmtime_r(5). Instead, we need to implement
it with gmtime_s() that has a slightly different interface.
@@ -38,6 +38,14 @@ static inline int getpagesize(void)
GetSystemInfo(&info);
return info.dwPageSize;
}
+
+static inline struct tm *gmtime_r(const time_t *timep, struct tm *result)
+{
+ if (gmtime_s(result, timep))
+ return NULL;
+ return result;
+}
+
#else
#include <netdb.h>
#include <netinet/in.h>
