From 487a13c7c8e23268145c3dd88317cd8ea547c901 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Wed, 14 Apr 2010 06:56:24 +0200 Subject: win32: add gmtime_r() --- include/mingw.h | 2 +- win32/mingw.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/mingw.h b/include/mingw.h index 45bd32df1..a646af334 100644 --- a/include/mingw.h +++ b/include/mingw.h @@ -221,7 +221,7 @@ NOIMPL(waitpid,pid_t pid UNUSED_PARAM, int *status UNUSED_PARAM, unsigned option /* * time.h */ -IMPL(gmtime_r,struct tm *,NULL,const time_t *timep UNUSED_PARAM, struct tm *result UNUSED_PARAM); +struct tm *gmtime_r(const time_t *timep, struct tm *result); IMPL(localtime_r,struct tm *,NULL,const time_t *timep UNUSED_PARAM, struct tm *result UNUSED_PARAM); IMPL(strptime,char*,NULL,const char *s UNUSED_PARAM, const char *format UNUSED_PARAM, struct tm *tm UNUSED_PARAM); diff --git a/win32/mingw.c b/win32/mingw.c index 09d746f21..1a476651a 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -62,3 +62,10 @@ int pipe(int filedes[2]) return -1; return 0; } + +struct tm *gmtime_r(const time_t *timep, struct tm *result) +{ + /* gmtime() in MSVCRT.DLL is thread-safe, but not reentrant */ + memcpy(result, gmtime(timep), sizeof(struct tm)); + return result; +} -- cgit v1.2.3-55-g6feb