summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-01-25 12:36:25 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-01-25 12:36:25 +0800
commit78bb7c4b8790fc1b5f47adb84a8b228fb65b3a88 (patch)
tree437f96f3c6e2547b8b816d77ecd9337aadadf048
parent73bf6bd6489ef38af4df15ab768bc50744785fdf (diff)
downloadpttbbs-78bb7c4b8790fc1b5f47adb84a8b228fb65b3a88.tar
pttbbs-78bb7c4b8790fc1b5f47adb84a8b228fb65b3a88.tar.gz
pttbbs-78bb7c4b8790fc1b5f47adb84a8b228fb65b3a88.tar.bz2
pttbbs-78bb7c4b8790fc1b5f47adb84a8b228fb65b3a88.tar.lz
pttbbs-78bb7c4b8790fc1b5f47adb84a8b228fb65b3a88.tar.xz
pttbbs-78bb7c4b8790fc1b5f47adb84a8b228fb65b3a88.tar.zst
pttbbs-78bb7c4b8790fc1b5f47adb84a8b228fb65b3a88.zip
use ctime4 for compat on x86_64
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2430 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/proto.h1
-rw-r--r--mbbsd/bbs.c4
-rw-r--r--mbbsd/cal.c6
-rw-r--r--mbbsd/chicken.c10
-rw-r--r--mbbsd/edit.c2
-rw-r--r--mbbsd/register.c2
-rw-r--r--mbbsd/stuff.c8
-rw-r--r--mbbsd/syspost.c10
-rw-r--r--mbbsd/talk.c2
-rw-r--r--mbbsd/user.c12
-rw-r--r--mbbsd/vote.c8
-rw-r--r--mbbsd/voteboard.c6
-rw-r--r--util/angel.c2
-rw-r--r--util/reaper.c2
-rw-r--r--util/shmctl.c2
15 files changed, 43 insertions, 34 deletions
diff --git a/include/proto.h b/include/proto.h
index acc01f55..434e8e3d 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -576,6 +576,7 @@ void pressanykey_or_callangel(void);
#endif
struct tm *localtime4(time4_t *);
time4_t time4(time4_t *);
+char *ctime4(time4_t *);
/* syspost */
int post_msg(char* bname, char* title, char *msg, char* author);
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 1381e06b..7e13bf83 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -35,7 +35,7 @@ anticrosspost(void)
{
log_file("etc/illegal_money", LOG_CREAT | LOG_VF,
"\033[1;33;46m%s \033[37;45mcross post 文章 \033[37m %s\033[m\n",
- cuser.userid, Cdate(&now));
+ cuser.userid, ctime4(&now));
post_violatelaw(cuser.userid, "Ptt系統警察", "Cross-post", "罰單處份");
cuser.userlevel |= PERM_VIOLATELAW;
@@ -2692,7 +2692,7 @@ log_board(char *mode, time4_t usetime)
if (usetime > 30) {
log_file(FN_USEBOARD, LOG_CREAT | LOG_VF,
"USE %-20.20s Stay: %5ld (%s) %s\n",
- mode, usetime, cuser.userid, Cdate(&now));
+ mode, usetime, cuser.userid, ctime4(&now));
}
}
#endif
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index b2b877d8..1e58d53f 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -330,7 +330,7 @@ mail_redenvelop(char *from, char *to, int money, char mode)
"\033[1;33m親愛的 %s :\n\n\033[m"
"\033[1;31m 我包給你一個 %d 元的大紅包喔 ^_^\n\n"
" 禮輕情意重,請笑納...... ^_^\033[m\n",
- from, Cdate(&now), to, money);
+ from, ctime4(&now), to, money);
fclose(fp);
snprintf(fhdr.title, sizeof(fhdr.title), "招財進寶");
strlcpy(fhdr.owner, from, sizeof(fhdr.owner));
@@ -376,7 +376,7 @@ p_give()
deumoney(searchuser(id), money - tax);
demoney(-money);
log_file(FN_MONEY, LOG_CREAT | LOG_VF, "%s\t給%s\t%d\t%s",
- cuser.userid, id, money - tax, Cdate(&now));
+ cuser.userid, id, money - tax, ctime4(&now));
#ifdef PLAY_ANGEL
getuser(id);
if (!strcmp(xuser.myangel, cuser.userid)){
@@ -416,7 +416,7 @@ p_sysinfo(void)
#else
MAX_ACTIVE,
#endif
- compile_time, Cdate(&start_time));
+ compile_time, ctime4(&start_time));
if (HAS_PERM(PERM_SYSOP)) {
struct rusage ru;
getrusage(RUSAGE_SELF, &ru);
diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c
index 6881a9dc..05f857cc 100644
--- a/mbbsd/chicken.c
+++ b/mbbsd/chicken.c
@@ -137,7 +137,7 @@ new_chicken()
log_file(CHICKENLOG, LOG_CREAT | LOG_VF,
"\033[31m%s \033[m養了一隻叫\033[33m %s \033[m的 "
"\033[32m%s\033[m 於 %s\n", cuser.userid,
- mychicken->name, chicken_type[(int)mychicken->type], Cdate(&now));
+ mychicken->name, chicken_type[(int)mychicken->type], ctime4(&now));
mychicken->lastvisit = mychicken->birthday = mychicken->cbirth = now;
mychicken->food = 0;
mychicken->weight = time_change[(int)mychicken->type][WEIGHT] / 3;
@@ -431,7 +431,7 @@ ch_kill()
log_file(CHICKENLOG, LOG_CREAT | LOG_VF,
"\033[31m%s \033[m把 \033[33m%s\033[m\033[32m %s "
"\033[m宰了 於 %s\n", cuser.userid, mychicken->name,
- chicken_type[(int)mychicken->type], Cdate(&now));
+ chicken_type[(int)mychicken->type], ctime4(&now));
mychicken->name[0] = 0;
}
}
@@ -489,7 +489,7 @@ ch_sell()
"\033[31m%s\033[m 把 \033[33m%s\033[m "
"\033[32m%s\033[m 用 \033[36m%d\033[m 賣了 於 %s\n",
cuser.userid, mychicken->name,
- chicken_type[(int)mychicken->type], money, Cdate(&now));
+ chicken_type[(int)mychicken->type], money, ctime4(&now));
mychicken->lastvisit = mychicken->name[0] = 0;
passwd_update(usernum, &cuser);
more(CHICKEN_PIC "/sell", YEA);
@@ -645,7 +645,7 @@ deadtype(chicken_t * thechicken)
log_file(CHICKENLOG, LOG_CREAT | LOG_VF,
"\033[31m%s\033[m 所疼愛的\033[33m %s\033[32m %s "
"\033[m掛了 於 %s\n", cuser.userid, thechicken->name,
- chicken_type[(int)thechicken->type], Cdate(&now));
+ chicken_type[(int)thechicken->type], ctime4(&now));
mychicken->name[0] = 0;
passwd_update(usernum, &cuser);
}
@@ -703,7 +703,7 @@ ch_changename()
"\033[31m%s\033[m 把疼愛的\033[33m %s\033[32m %s "
"\033[m改名為\033[33m %s\033[m 於 %s\n",
cuser.userid, mychicken->name,
- chicken_type[(int)mychicken->type], newname, Cdate(&now));
+ chicken_type[(int)mychicken->type], newname, ctime4(&now));
}
}
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index 75b226b8..67dfccc5 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1012,7 +1012,7 @@ write_header(FILE * fp, int ifuseanony) // FIXME unused
}
save_title[72] = '\0';
- fprintf(fp, "標題: %s\n時間: %s\n\n", save_title, Cdate(&now));
+ fprintf(fp, "標題: %s\n時間: %s\n", save_title, ctime4(&now));
}
void
diff --git a/mbbsd/register.c b/mbbsd/register.c
index c3f736c5..6a2ae01e 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -111,7 +111,7 @@ check_and_expire_account(int uid, userec_t * urec)
int val;
if ((val = compute_user_value(urec, now)) < 0) {
snprintf(genbuf, sizeof(genbuf), "#%d %-12s %15.15s %d %d %d",
- uid, urec->userid, Cdate(&(urec->lastlogin)) + 4,
+ uid, urec->userid, ctime4(&(urec->lastlogin)) + 4,
urec->numlogins, urec->numposts, val);
if (val > -1 * 60 * 24 * 365) {
log_usies("CLEAN", genbuf);
diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c
index 569bddc0..945c0ded 100644
--- a/mbbsd/stuff.c
+++ b/mbbsd/stuff.c
@@ -499,6 +499,14 @@ 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];
diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c
index 34804f1b..ab686d6a 100644
--- a/mbbsd/syspost.c
+++ b/mbbsd/syspost.c
@@ -18,7 +18,7 @@ post_msg(char *bname, char *title, char *msg, char *author)
return -1;
fprintf(fp, "作者: %s 看板: %s\n標題: %s \n", author, bname, title);
- fprintf(fp, "時間: %s\n", Cdate(&now));
+ fprintf(fp, "時間: %s\n", ctime4(&now));
/* 文章的內容 */
fputs(msg, fp);
@@ -69,7 +69,7 @@ post_change_perm(int oldperm, int newperm, char *sysopid, char *userid)
fprintf(fp, "作者: [系統安全局] 看板: Security\n"
"標題: [公安報告] 站長修改權限報告\n"
- "時間: %s\n", Cdate(&now));
+ "時間: %s\n", ctime4(&now));
for (i = 5; i < NUMPERMS; i++) {
if (((oldperm >> i) & 1) != ((newperm >> i) & 1)) {
fprintf(fp, " 站長\033[1;32m%s%s%s%s\033[m的權限\n",
@@ -114,7 +114,7 @@ post_violatelaw(char *crime, char *police, char *reason, char *result)
"時間: %s\n"
"\033[1;32m%s\033[m判決:\n \033[1;32m%s\033[m"
"因\033[1;35m%s\033[m行為,\n違反本站站規,處以\033[1;35m%s\033[m,特此公告",
- crime, Cdate(&now), police, crime, reason, result);
+ crime, ctime4(&now), police, crime, reason, result);
fclose(fp);
snprintf(fhdr.title, sizeof(fhdr.title),
"[報告] %-20s 違法判決報告", crime);
@@ -131,7 +131,7 @@ post_violatelaw(char *crime, char *police, char *reason, char *result)
"時間: %s\n"
"\033[1;32m%s\033[m判決:\n \033[1;32m%s\033[m"
"因\033[1;35m%s\033[m行為,\n違反本站站規,處以\033[1;35m%s\033[m,特此公告",
- crime, Cdate(&now), police, crime, reason, result);
+ crime, ctime4(&now), police, crime, reason, result);
fclose(fp);
snprintf(fhdr.title, sizeof(fhdr.title),
"[報告] %s:%-*s 判決", crime,
@@ -167,7 +167,7 @@ give_money_post(char *userid, int money)
return;
fprintf(fp, "作者: [系統安全局] 看板: Security\n"
"標題: [公安報告] 站長%s使用紅包機報告\n"
- "時間: %s\n", cuser.userid, Cdate(&now));
+ "時間: %s\n", cuser.userid, ctime4(&now));
clrtobot();
clear();
fprintf(fp, "\n 站長\033[1;32m%s\033[m給\033[1;33m%s %d 元\033[m",
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index ae5db603..5097db6a 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -2563,7 +2563,7 @@ userlist(void)
log_file(FN_MONEY, LOG_CREAT | LOG_VF,
"%s\t給%s\t%d\t%s\n", cuser.userid,
uentp->userid, ch,
- Cdate(&currutmp->lastact));
+ ctime4(&currutmp->lastact));
mail_redenvelop(cuser.userid, uentp->userid,
ch - give_tax(ch), 'Y');
vmsg(" 嗯..還剩下 %d 錢..", demoney(-ch));
diff --git a/mbbsd/user.c b/mbbsd/user.c
index df6ad091..21ab99b1 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -102,9 +102,9 @@ user_display(userec_t * u, int real)
prints(" 小 天 使: %s\n",
u->myangel[0] ? u->myangel : "無");
#endif
- prints(" 註冊日期: %s\n", Cdate(&u->firstlogin));
- prints(" 前次光臨: %s\n", Cdate(&u->lastlogin));
- prints(" 前次點歌: %s\n", Cdate(&u->lastsong));
+ prints(" 註冊日期: %s", ctime4(&u->firstlogin));
+ prints(" 前次光臨: %s", ctime4(&u->lastlogin));
+ prints(" 前次點歌: %s", ctime4(&u->lastsong));
prints(" 上站文章: %d 次 / %d 篇\n",
u->numlogins, u->numposts);
@@ -183,7 +183,7 @@ mail_violatelaw(char *crime, char *police, char *reason, char *result)
"\033[1;32m%s\033[m判決:\n \033[1;32m%s\033[m"
"因\033[1;35m%s\033[m行為,\n違反本站站規,處以\033[1;35m%s\033[m,特此通知"
"\n請到 PttLaw 查詢相關法規資訊,並到 Play-Pay-ViolateLaw 繳交罰單",
- Cdate(&now), police, crime, reason, result);
+ ctime4(&now), police, crime, reason, result);
fclose(fp);
strcpy(fhdr.title, "[報告] 違法判決報告");
strcpy(fhdr.owner, "[Ptt法院]");
@@ -744,7 +744,7 @@ uinfo_query(userec_t * u, int real, int unum)
"時間: %s\n"
" 站長\033[1;32m%s\033[m把\033[1;32m%s\033[m"
"的錢從\033[1;35m%d\033[m改成\033[1;35m%d\033[m",
- Cdate(&now), cuser.userid, x.userid, money, x.money);
+ ctime4(&now), cuser.userid, x.userid, money, x.money);
clrtobot();
clear();
@@ -1165,7 +1165,7 @@ toregister(char *email, char *genbuf, char *phone, char *career,
REGFORM2:
if (strcasecmp(email, "x") == 0) { /* 手動認證 */
if ((fn = fopen(fn_register, "a"))) {
- fprintf(fn, "num: %d, %s\n", usernum, Cdate(&now));
+ fprintf(fn, "num: %d, %s\n", usernum, ctime4(&now));
fprintf(fn, "uid: %s\n", cuser.userid);
fprintf(fn, "ident: %s\n", ident);
fprintf(fn, "name: %s\n", rname);
diff --git a/mbbsd/vote.c b/mbbsd/vote.c
index 5dd74229..eb5a576b 100644
--- a/mbbsd/vote.c
+++ b/mbbsd/vote.c
@@ -288,7 +288,7 @@ b_result_one(vote_buffer_t *vbuf, boardheader_t * fh, int ind, int *total)
fclose(xfp);
}
fprintf(tfp, "%s\n◆ 投票中止於: %s\n\n◆ 票選題目描述:\n\n",
- msg_seperator, Cdate(&closetime));
+ msg_seperator, ctime4(&closetime));
fh->vtime = now;
setbfile(buf, bname, vbuf->desc);
@@ -405,7 +405,7 @@ b_closepolls()
}
if ((cfp = fopen(fn_vote_polling, "w")) == NULL)
return 0;
- fprintf(cfp, "%d\n%s\n", now, Cdate(&now));
+ fprintf(cfp, "%d\n%s\n", now, ctime4(&now));
fclose(cfp);
#endif
@@ -476,7 +476,7 @@ vote_view(vote_buffer_t *vbuf, char *bname, int vote_index)
prints("\n◆ 預知投票紀事: 每人最多可投 %d 票,目前共有 %d 票,\n"
"本次投票將結束於 %s", atoi(inbuf), (int)(num / sizeof(short)),
- Cdate(&closetime));
+ ctime4(&closetime));
/* Thor: 開放 票數 預知 */
setbfile(buf, bname, vbuf->flags);
@@ -857,7 +857,7 @@ user_vote_one(vote_buffer_t *vbuf, char *bname, int ind)
prints("投票方式:確定好您的選擇後,輸入其代碼(A, B, C...)即可。\n"
"此次投票你可以投 %1hd 票。按 0 取消投票, 1 完成投票, > 下一頁, < 上一頁\n"
"此次投票將結束於:%s \n",
- tickets, Cdate(&closetime));
+ tickets, ctime4(&closetime));
#define REDO_DRAW 1
#define REDO_SCAN 2
diff --git a/mbbsd/voteboard.c b/mbbsd/voteboard.c
index 21dcc721..28e9f7a6 100644
--- a/mbbsd/voteboard.c
+++ b/mbbsd/voteboard.c
@@ -110,7 +110,7 @@ do_voteboardreply(fileheader_t * fhdr)
}
if (!endtime) {
now += 14 * 24 * 60 * 60;
- fprintf(fo, "連署結束時間: (%d)%s\n", now, Cdate(&now));
+ fprintf(fo, "連署結束時間: (%d)%s\n", now, ctime4(&now));
now -= 14 * 24 * 60 * 60;
}
fputs(genbuf, fo);
@@ -321,7 +321,7 @@ do_voteboard(int type)
now += 14 * 24 * 60 * 60;
snprintf(topic, sizeof(topic), "(%d)", now);
strcat(genbuf, topic);
- strcat(genbuf, Cdate(&now));
+ strcat(genbuf, ctime4(&now));
strcat(genbuf, "\n");
now -= 14 * 24 * 60 * 60;
strcat(genbuf, "----------支持----------\n");
@@ -337,7 +337,7 @@ do_voteboard(int type)
fprintf(fp, "%s%s %s%s\n%s%s\n%s%s\n", "作者: ", cuser.userid,
"看板: ", currboard,
"標題: ", title,
- "時間: ", Cdate(&now));
+ "時間: ", ctime4(&now));
fprintf(fp, "%s\n", genbuf);
fclose(fp);
strlcpy(votefile.owner, cuser.userid, sizeof(votefile.owner));
diff --git a/util/angel.c b/util/angel.c
index f074285f..247f4f02 100644
--- a/util/angel.c
+++ b/util/angel.c
@@ -144,7 +144,7 @@ void sendResult(){
"時間: %s\n"
"\n現在全站小天使有 %d 位\n"
"\n小主人人數最多的 %d 位小天使:\n",
- Cdate(&t), count, nReport);
+ ctime4(&t), count, nReport);
for (i = 0; i < nReport; ++i)
fprintf(fp, "%15s %5d 人\n", SHM->userid[list[i][1] - 1], list[i][0]);
fprintf(fp, "\n現在男女皆收的小天使有 %d 位\n"
diff --git a/util/reaper.c b/util/reaper.c
index f67d38ac..5c065a71 100644
--- a/util/reaper.c
+++ b/util/reaper.c
@@ -32,7 +32,7 @@ int check(int n, userec_t *u) {
int unum;
unum = searchuser(u->userid);
- strcpy(buf, Cdate(&u->lastlogin));
+ strcpy(buf, ctime4(&u->lastlogin));
syslog(LOG_NOTICE, "kill user(%d): %s %s", unum, u->userid, buf);
sprintf(buf, "mv home/%c/%s tmp/", u->userid[0], u->userid);
if(system(buf))
diff --git a/util/shmctl.c b/util/shmctl.c
index 143bb64a..bbf0239e 100644
--- a/util/shmctl.c
+++ b/util/shmctl.c
@@ -187,7 +187,7 @@ int utmpfix(int argc, char **argv)
idle[i].idle >
(timeout == -1 ? IDLE_TIMEOUT : timeout) ){
sprintf(buf, "timeout(%s)",
- Cdate(&SHM->uinfo[which].lastact));
+ ctime4(&SHM->uinfo[which].lastact));
clean = buf;
if( SHM->uinfo[which].pid > 0 )
kill(SHM->uinfo[which].pid, SIGHUP);