From fa2ca034cb407aa6fca8768cf6c7c1a70e950782 Mon Sep 17 00:00:00 2001 From: piaip Date: Mon, 5 May 2008 01:43:15 +0000 Subject: - (internal) add more Cdate format function git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4268 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- common/sys/time.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/sys/time.c b/common/sys/time.c index 8564b514..bf8164c9 100644 --- a/common/sys/time.c +++ b/common/sys/time.c @@ -39,7 +39,7 @@ int getHoroscope(int m, int d) /** * 23+1 bytes, "12/31/2007 00:00:00 Mon\0" */ -char * +const char* Cdate(const time4_t *clock) { time_t temp = (time_t)*clock; @@ -52,7 +52,7 @@ Cdate(const time4_t *clock) /** * 19+1 bytes, "12/31/2007 00:00:00\0" */ -char * +const char* Cdatelite(const time4_t *clock) { time_t temp = (time_t)*clock; @@ -65,7 +65,7 @@ Cdatelite(const time4_t *clock) /** * 10+1 bytes, "12/31/2007\0" */ -char * +const char* Cdatedate(const time4_t * clock) { time_t temp = (time_t)*clock; @@ -75,6 +75,19 @@ Cdatedate(const time4_t * clock) return cdate_buffer; } +/** + * 11+1 bytes, "12/31 10:01\0" + */ +const char* +Cdate_mdHM(const time4_t * clock) +{ + time_t temp = (time_t)*clock; + struct tm *mytm = localtime(&temp); + + strftime(cdate_buffer, sizeof(cdate_buffer), "%m/%d %H:%M", mytm); + return cdate_buffer; +} + #ifdef TIMET64 char * ctime4(const time4_t *clock) @@ -103,7 +116,7 @@ time4_t time4(time4_t *ptr) } #endif -char * +const char* my_ctime(const time4_t * t, char *ans, int len) { struct tm *tp; -- cgit v1.2.3