Commit c84e332e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Add a bug. Fix compilation on Win32.

parent 9020d59c
......@@ -233,10 +233,21 @@ static int Seek (access_t *access, int64_t offset)
}
#ifdef WIN32
#ifndef HAVE_LOCALTIME_R
static inline struct tm *localtime_r (const time_t *now, struct tm *res)
{
return _localtime_s (res, now) ? NULL : res;
struct tm *unsafe = localtime (now);
/*
* This is not thread-safe. Blame your C library.
* On Win32 there SHOULD be _localtime_s instead, but of course
* Cygwin and Mingw32 don't know about it. You're on your own if you
* this platform.
*/
if (unsafe == NULL)
return NULL;
memcpy (res, unsafe, sizeof (*res));
return res;
}
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment