diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-05-05 09:43:15 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-05-05 09:43:15 +0800 |
commit | fa2ca034cb407aa6fca8768cf6c7c1a70e950782 (patch) | |
tree | b6dce82c820f605394a8efbfedd1c20b16a25b3c /common/sys | |
parent | 94eeb4478b69e15f9a3c78176eac642aab95faf3 (diff) | |
download | pttbbs-fa2ca034cb407aa6fca8768cf6c7c1a70e950782.tar pttbbs-fa2ca034cb407aa6fca8768cf6c7c1a70e950782.tar.gz pttbbs-fa2ca034cb407aa6fca8768cf6c7c1a70e950782.tar.bz2 pttbbs-fa2ca034cb407aa6fca8768cf6c7c1a70e950782.tar.lz pttbbs-fa2ca034cb407aa6fca8768cf6c7c1a70e950782.tar.xz pttbbs-fa2ca034cb407aa6fca8768cf6c7c1a70e950782.tar.zst pttbbs-fa2ca034cb407aa6fca8768cf6c7c1a70e950782.zip |
- (internal) add more Cdate format function
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4268 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'common/sys')
-rw-r--r-- | common/sys/time.c | 21 |
1 files changed, 17 insertions, 4 deletions
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; |