diff options
-rw-r--r-- | include/bbs.h | 4 | ||||
-rw-r--r-- | include/proto.h | 12 | ||||
-rw-r--r-- | mbbsd/admin.c | 2 | ||||
-rw-r--r-- | mbbsd/stuff.c | 18 | ||||
-rw-r--r-- | sample/pttbbs.conf | 3 |
5 files changed, 27 insertions, 12 deletions
diff --git a/include/bbs.h b/include/bbs.h index 654bb83c..ea0de9da 100644 --- a/include/bbs.h +++ b/include/bbs.h @@ -37,7 +37,11 @@ #include <sys/sem.h> #include <sys/msg.h> +#ifdef TIMET64 typedef uint32_t time4_t; +#else +typedef time_t time4_t; +#endif /* our header */ #include "config.h" diff --git a/include/proto.h b/include/proto.h index 434e8e3d..b211ff1c 100644 --- a/include/proto.h +++ b/include/proto.h @@ -574,9 +574,15 @@ int towrite(int fd, void *buf, int len); #ifdef PLAY_ANGEL void pressanykey_or_callangel(void); #endif -struct tm *localtime4(time4_t *); -time4_t time4(time4_t *); -char *ctime4(time4_t *); +#ifdef TIMET64 + struct tm *localtime4(time4_t *); + time4_t time4(time4_t *); + char *ctime4(time4_t *); +#else + #define localtime4(a) localtime(a) + #define time4(a) time(a) + #define ctime4(a) ctime(a) +#endif /* syspost */ int post_msg(char* bname, char* title, char *msg, char* author); diff --git a/mbbsd/admin.c b/mbbsd/admin.c index a8bccb03..00442c70 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -1355,7 +1355,7 @@ give_id_money(char *user_id, int money, FILE * log_fp, char *mail_title, time4_t prints("id:%s money:%d 不對吧!!", user_id, money); pressanykey(); } else { - fprintf(log_fp, "%d %s %d", t, user_id, money); + fprintf(log_fp, "%d %s %d", (int)t, user_id, money); snprintf(tt, sizeof(tt), "%s : %d ptt 幣", mail_title, money); mail_id(user_id, tt, "etc/givemoney.why", "[PTT 銀行]"); } diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c index 945c0ded..602c9b4b 100644 --- a/mbbsd/stuff.c +++ b/mbbsd/stuff.c @@ -499,14 +499,6 @@ gettime(int line, time4_t dt, char*head) #endif char * -ctime4(time4_t *clock) -{ - time_t temp = (time_t)*clock; - - return ctime(&temp); -} - -char * Cdate(time4_t *clock) { static char foo[32]; @@ -946,6 +938,15 @@ int qsort_intcompar(const void *a, const void *b) return *(int *)a - *(int *)b; } +#ifdef TIMET64 +char * +ctime4(time4_t *clock) +{ + time_t temp = (time_t)*clock; + + return ctime(&temp); +} + struct tm *localtime4(time4_t *t) { if( t == NULL ) @@ -963,6 +964,7 @@ time4_t time4(time4_t *ptr) else return *ptr = (time4_t)time(NULL); } +#endif #ifdef OUTTACACHE #include <err.h> diff --git a/sample/pttbbs.conf b/sample/pttbbs.conf index 353c7c6d..6a1559c6 100644 --- a/sample/pttbbs.conf +++ b/sample/pttbbs.conf @@ -163,6 +163,9 @@ /* 如果是在 IA32 底下的話, 可以定義 IA32 以取得記憶體統計資訊 */ //#define IA32 +/* 如果 time_t 是 8 bytes的話 (如 X86_64) */ +//#define TIMET64 + /* 前進站畫面 */ #define INSCREEN \ "前進站畫面 (請至 pttbbs.conf 修改您的前進站畫面)" |