Fix compilation of misc.c with gmtime_r replacement function for mingw

https://github.com/Hamlib/Hamlib/issues/784
pull/788/head
Mike Black W9MDB 2021-09-02 17:08:10 -05:00
rodzic 6de4588335
commit 820e4d4310
1 zmienionych plików z 21 dodań i 0 usunięć

Wyświetl plik

@ -2346,6 +2346,27 @@ uint32_t CRC32_function(uint8_t *buf, uint32_t len)
return crc ^ 0xFFFFFFFF;
}
#if defined(_WIN32)
// gmtime_r can be defined by mingw
#ifndef gmtime_r
static struct tm *gmtime_r(const time_t *t, struct tm *r)
{
// gmtime is threadsafe in windows because it uses TLS
struct tm *theTm = gmtime(t);
if (theTm)
{
*r = *theTm;
return r;
}
else
{
return 0;
}
}
#endif // gmtime_r
#endif // _WIN32
//! @cond Doxygen_Suppress
char *date_strget(char *buf, int buflen)
{