diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-03-15 15:29:54 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-03-15 15:29:54 +0800 |
commit | b78e3948144360a41a582d4b56a2c000e7eb44c6 (patch) | |
tree | 6456318d876326fa02aeea1d91598eb5f407b712 /web/mytime.h | |
parent | 2b77229a09701b117abd7e64f5d6b26b81d45bd1 (diff) | |
download | pttbbs-b78e3948144360a41a582d4b56a2c000e7eb44c6.tar pttbbs-b78e3948144360a41a582d4b56a2c000e7eb44c6.tar.gz pttbbs-b78e3948144360a41a582d4b56a2c000e7eb44c6.tar.bz2 pttbbs-b78e3948144360a41a582d4b56a2c000e7eb44c6.tar.lz pttbbs-b78e3948144360a41a582d4b56a2c000e7eb44c6.tar.xz pttbbs-b78e3948144360a41a582d4b56a2c000e7eb44c6.tar.zst pttbbs-b78e3948144360a41a582d4b56a2c000e7eb44c6.zip |
no longer maintained
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1594 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'web/mytime.h')
-rwxr-xr-x | web/mytime.h | 189 |
1 files changed, 0 insertions, 189 deletions
diff --git a/web/mytime.h b/web/mytime.h deleted file mode 100755 index c9e4f29d..00000000 --- a/web/mytime.h +++ /dev/null @@ -1,189 +0,0 @@ -/* Ptt : 常用函式整理 */ - -/* - * 時間處理 - */ -#include <time.h> -#ifdef _BBS_UTIL - #undef pstrdup - #define pstrdup(p, str) strdup(str) -#endif - -int -mygetdate(time_t clock, int *year, int *mon, int *mday, int *week) -{ - struct tm *mytm = localtime(&clock); - if(year) *year = mytm->tm_year; /* 98 */ - if(mon) *mon = mytm->tm_mon + 1; /* 1~12 */ - if(mday) *mday = mytm->tm_mday; /* 1~31 */ - if(week) *week = mytm->tm_wday; /* 0~6 */ - return 0; -} - -char * -Cdatenum_slash(pool *p,time_t *clock) /* 98/04/21 */ -{ - char foo[22]; - struct tm *mytm = localtime(clock); - strftime(foo, 22, "%y/%m/%d", mytm); - return pstrdup(p, foo); -} - -char * -Cdatenum(pool *p,time_t *clock) /* 980421 */ -{ - char foo[22]; - struct tm *mytm = localtime(clock); - strftime(foo, 22, "%y%m%d", mytm); - return pstrdup(p, foo); -} - - -#ifndef _BBS_UTIL -char * -Cdatefullnum(pool *p,time_t *clock) /* 19980421 */ -{ - char foo[22]; - struct tm *mytm = localtime(clock); - strftime(foo, 22, "%Y%m%d", mytm); - return pstrdup(p, foo); -} -#else -char * -Cdatefullnum(char *p,time_t *clock) /* 19980421 */ -{ - static char foo[22]; - struct tm *mytm = localtime(clock); - strftime(foo, 22, "%Y%m%d", mytm); - return foo; -} -#endif - -char * -Cdate(char *p,time_t *clock) -{ - char foo[22]; - struct tm *mytm = localtime(clock); - strftime(foo, 22, "%D %T %a", mytm); - return pstrdup(p, foo); -} - -char * -Cdatelite(char *p,time_t *clock) -{ - char foo[18]; - struct tm *mytm = localtime(clock); - strftime(foo, 18, "%D %T", mytm); - return pstrdup(p, foo); -} - -char * -whattime(char *p,time_t *clock) -{ - char foo[18]; - struct tm *mytm = localtime(clock); - strftime(foo, 18, "%H:%M:%S", mytm); - return pstrdup(p, foo); -} - -char * -whatyear(char *p,time_t *clock) -{ - char foo[6]; - struct tm *mytm = localtime(clock); - strftime(foo, 6, "%Y", mytm); - return pstrdup(p, foo); -} - -char * -whatmonth(char *p,time_t *clock) -{ - char foo[4]; - struct tm *mytm = localtime(clock); - strftime(foo, 4, "%m", mytm); - return pstrdup(p, foo); -} - -char * -whatday(char *p,time_t *clock) -{ - char foo[4]; - struct tm *mytm = localtime(clock); - strftime(foo, 4, "%d", mytm); - return pstrdup(p, foo); -} - -char * -C_week(pool *p, int a) -{ - char foo[5]=""; - switch(a) - { - case 0: - case 7: - strcpy(foo,"日"); - break; - case 1: - strcpy(foo,"一"); - break; - case 2: - strcpy(foo,"二"); - break; - case 3: - strcpy(foo,"三"); - break; - case 4: - strcpy(foo,"四"); - break; - case 5: - strcpy(foo,"五"); - break; - case 6: - strcpy(foo,"六"); - break; - } - return pstrdup(p, foo); -} - -char * -whatweek(char *p,time_t *clock) -{ - struct tm *mytm = localtime(clock); - return C_week(p, mytm->tm_wday); -} - -char * -whathour(char *p,time_t *clock) -{ - char foo[4]=""; - struct tm *mytm = localtime(clock); - strftime(foo, 6, "%H", mytm); - return pstrdup(p, foo); -} - -char * -whatminute(char *p,time_t *clock) -{ - char foo[4]=""; - struct tm *mytm = localtime(clock); - strftime(foo, 6, "%M", mytm); - return pstrdup(p, foo); -} - -char * -whatsecond(char *p,time_t *clock) -{ - char foo[4]=""; - struct tm *mytm = localtime(clock); - strftime(foo, 6, "%S", mytm); - return pstrdup(p, foo); -} - -char * -Wholetime(char *p,time_t *clock) /* 19980421 */ -{ - char foo[40]; - struct tm *mytm = localtime(clock); - strftime(foo, 40, "%Y年%m月%d日%H時%M分%S秒", mytm); - return pstrdup(p, foo); -} |