diff options
author | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-03-01 20:15:42 +0800 |
---|---|---|
committer | wens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-03-01 20:15:42 +0800 |
commit | 6ff0fa50367360a9590c76b392571550fc3d15f7 (patch) | |
tree | 5679f1417ed114b8060e5efde6bdf28c9278edf6 /common | |
parent | b845233c50d73dfca2f0e91a7bdc2c480ed5753c (diff) | |
download | pttbbs-6ff0fa50367360a9590c76b392571550fc3d15f7.tar pttbbs-6ff0fa50367360a9590c76b392571550fc3d15f7.tar.gz pttbbs-6ff0fa50367360a9590c76b392571550fc3d15f7.tar.bz2 pttbbs-6ff0fa50367360a9590c76b392571550fc3d15f7.tar.lz pttbbs-6ff0fa50367360a9590c76b392571550fc3d15f7.tar.xz pttbbs-6ff0fa50367360a9590c76b392571550fc3d15f7.tar.zst pttbbs-6ff0fa50367360a9590c76b392571550fc3d15f7.zip |
remove my_ctime
add ctime4_r
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4442 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'common')
-rw-r--r-- | common/sys/time.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/common/sys/time.c b/common/sys/time.c index 3031d445..5cf20dc1 100644 --- a/common/sys/time.c +++ b/common/sys/time.c @@ -115,6 +115,14 @@ ctime4(const time4_t *clock) return ctime(&temp); } +char * +ctime4_r(const time4_t *t, char *buf) +{ + time_t temp = (time_t)*t; + + return ctime_r(&temp, buf); +} + // XXX TODO change this to localtime_r style someday. struct tm *localtime4(const time4_t *t) { @@ -148,16 +156,3 @@ time4_t time4(time4_t *ptr) return *ptr = (time4_t)time(NULL); } #endif - -const char* -my_ctime(const time4_t * t, char *ans, int len) -{ - time_t temp = (time_t)*clock; - struct tm tp; - - localtime_r(&temp, &tp); - snprintf(ans, len, - "%02d/%02d/%02d %02d:%02d:%02d", (tp.tm_year % 100), - tp.tm_mon + 1, tp.tm_mday, tp.tm_hour, tp.tm_min, tp.tm_sec); - return ans; -} |