From d74ae1e8f983520c4fa0322daeedc9bcc9304710 Mon Sep 17 00:00:00 2001 From: piaip Date: Mon, 5 May 2008 09:57:21 +0000 Subject: - (internal) replace all localtime4() by localtime4_r(). git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4272 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 7a3768c1..3031d445 100644 --- a/common/sys/time.c +++ b/common/sys/time.c @@ -78,6 +78,20 @@ Cdatedate(const time4_t * clock) return cdate_buffer; } +/** + * 5+1 bytes, "12/31\0" + */ +const char* +Cdate_md(const time4_t * clock) +{ + time_t temp = (time_t)*clock; + struct tm mytm; + + localtime_r(&temp, &mytm); + strftime(cdate_buffer, sizeof(cdate_buffer), "%m/%d", &mytm); + return cdate_buffer; +} + /** * 11+1 bytes, "12/31 10:01\0" */ -- cgit v1.2.3