summaryrefslogtreecommitdiffstats
path: root/common/sys/time.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-05-05 17:14:19 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-05-05 17:14:19 +0800
commitb31a0e3d53ce17d4626fe125dd1e1f654a0d192c (patch)
tree0413d8feb94f09c0a2ea157328b760bf1f80ed60 /common/sys/time.c
parent1f0b3cd9795e2979fc3c4454d4fbcf74c65298e0 (diff)
downloadpttbbs-b31a0e3d53ce17d4626fe125dd1e1f654a0d192c.tar
pttbbs-b31a0e3d53ce17d4626fe125dd1e1f654a0d192c.tar.gz
pttbbs-b31a0e3d53ce17d4626fe125dd1e1f654a0d192c.tar.bz2
pttbbs-b31a0e3d53ce17d4626fe125dd1e1f654a0d192c.tar.lz
pttbbs-b31a0e3d53ce17d4626fe125dd1e1f654a0d192c.tar.xz
pttbbs-b31a0e3d53ce17d4626fe125dd1e1f654a0d192c.tar.zst
pttbbs-b31a0e3d53ce17d4626fe125dd1e1f654a0d192c.zip
- (internal) add localtime4_r thread-safe API
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4271 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'common/sys/time.c')
-rw-r--r--common/sys/time.c14
1 files changed, 14 insertions, 0 deletions
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 )