aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-14 06:56:40 +0200
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-10 18:39:57 +1000
commit4e52a794ba999c0de0a166ae5e8dac2e67b93964 (patch)
tree69a7ee5e2163855ee321a33ad352e72aa0447c88
parent487a13c7c8e23268145c3dd88317cd8ea547c901 (diff)
downloadbusybox-w32-4e52a794ba999c0de0a166ae5e8dac2e67b93964.tar.gz
busybox-w32-4e52a794ba999c0de0a166ae5e8dac2e67b93964.tar.bz2
busybox-w32-4e52a794ba999c0de0a166ae5e8dac2e67b93964.zip
win32: add localtime_r()
-rw-r--r--include/mingw.h2
-rw-r--r--win32/mingw.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/include/mingw.h b/include/mingw.h
index a646af334..9bca3cf35 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -222,7 +222,7 @@ NOIMPL(waitpid,pid_t pid UNUSED_PARAM, int *status UNUSED_PARAM, unsigned option
222 * time.h 222 * time.h
223 */ 223 */
224struct tm *gmtime_r(const time_t *timep, struct tm *result); 224struct tm *gmtime_r(const time_t *timep, struct tm *result);
225IMPL(localtime_r,struct tm *,NULL,const time_t *timep UNUSED_PARAM, struct tm *result UNUSED_PARAM); 225struct tm *localtime_r(const time_t *timep, struct tm *result);
226IMPL(strptime,char*,NULL,const char *s UNUSED_PARAM, const char *format UNUSED_PARAM, struct tm *tm UNUSED_PARAM); 226IMPL(strptime,char*,NULL,const char *s UNUSED_PARAM, const char *format UNUSED_PARAM, struct tm *tm UNUSED_PARAM);
227 227
228/* 228/*
diff --git a/win32/mingw.c b/win32/mingw.c
index 1a476651a..9ce7bc3ff 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -69,3 +69,10 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result)
69 memcpy(result, gmtime(timep), sizeof(struct tm)); 69 memcpy(result, gmtime(timep), sizeof(struct tm));
70 return result; 70 return result;
71} 71}
72
73struct tm *localtime_r(const time_t *timep, struct tm *result)
74{
75 /* localtime() in MSVCRT.DLL is thread-safe, but not reentrant */
76 memcpy(result, localtime(timep), sizeof(struct tm));
77 return result;
78}