From b31a0e3d53ce17d4626fe125dd1e1f654a0d192c Mon Sep 17 00:00:00 2001 From: piaip Date: Mon, 5 May 2008 09:14:19 +0000 Subject: - (internal) add localtime4_r thread-safe API git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4271 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- common/sys/time.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'common') diff --git a/common/sys/time.c b/common/sys/time.c index 7cf963b3..7a3768c1 100644 --- a/common/sys/time.c +++ b/common/sys/time.c @@ -112,6 +112,20 @@ struct tm *localtime4(const time4_t *t) } } +struct tm* +localtime4_r(const time4_t *t, struct tm *pt) +{ + if (t) + { + time_t temp = (time_t)*t; + localtime_r(&temp, pt); + } + else + localtime_r(NULL, pt); + return pt; +} + + time4_t time4(time4_t *ptr) { if( ptr == NULL ) -- cgit v1.2.3