Migrated away from using asctime() and ctime() - in favor of strftime().

Added year to several datestamps. Unbounded dates are locale-specific.
- Minor re-formatting was needed for STAT PLAYER and SHOW PLAYER.
The 'slay' feature of do_kill now requires a GRGOD or higher.
'last *' and 'last all' are now synonyms.
This commit is contained in:
wyld-sw
2015-09-18 09:16:04 -04:00
parent ffead13dc1
commit 5119361f15
10 changed files with 178 additions and 176 deletions

View File

@@ -996,7 +996,6 @@ ACMD(do_time)
break;
}
}
send_to_char(ch, "The %d%s Day of the %s, Year %d.\r\n",
day, suf, month_name[time_info.month], time_info.year);
}
@@ -1363,7 +1362,7 @@ ACMD(do_who)
ACMD(do_users)
{
char line[200], line2[220], idletime[10], classname[20];
char state[30], *timeptr, mode;
char state[30], timestr[9], mode;
char name_search[MAX_INPUT_LENGTH], host_search[MAX_INPUT_LENGTH];
struct char_data *tch;
struct descriptor_data *d;
@@ -1463,9 +1462,7 @@ ACMD(do_users)
} else
strcpy(classname, " - ");
timeptr = asctime(localtime(&d->login_time));
timeptr += 11;
*(timeptr + 8) = '\0';
strftime(timestr, sizeof(timestr), "%H:%M:%S", localtime(&(d->login_time)));
if (STATE(d) == CON_PLAYING && d->original)
strcpy(state, "Switched");
@@ -1482,7 +1479,7 @@ ACMD(do_users)
d->original && d->original->player.name ? d->original->player.name :
d->character && d->character->player.name ? d->character->player.name :
"UNDEFINED",
state, idletime, timeptr);
state, idletime, timestr);
if (d->host && *d->host)
sprintf(line + strlen(line), "[%s]\r\n", d->host);
@@ -2405,8 +2402,7 @@ ACMD(do_whois)
send_to_char(ch, "Level: %d\r\n", GET_LEVEL(victim));
if (!(GET_LEVEL(victim) < LVL_IMMORT) || (GET_LEVEL(ch) >= GET_LEVEL(victim))) {
strcpy (buf, (char *) asctime(localtime(&(victim->player.time.logon))));
buf[10] = '\0';
strftime(buf, sizeof(buf), "%a %b %d %Y", localtime(&(victim->player.time.logon)));
hours = (time(0) - victim->player.time.logon) / 3600;

View File

@@ -100,7 +100,7 @@ ACMD(do_kill)
char arg[MAX_INPUT_LENGTH];
struct char_data *vict;
if (GET_LEVEL(ch) < LVL_IMMORT || IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_NOHASSLE)) {
if (GET_LEVEL(ch) < LVL_GRGOD || IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_NOHASSLE)) {
do_hit(ch, argument, cmd, subcmd);
return;
}

View File

@@ -764,16 +764,14 @@ static void do_stat_character(struct char_data *ch, struct char_data *k)
if (!IS_NPC(k)) {
char buf1[64], buf2[64];
strlcpy(buf1, asctime(localtime(&(k->player.time.birth))), sizeof(buf1));
strlcpy(buf2, asctime(localtime(&(k->player.time.logon))), sizeof(buf2));
buf1[10] = buf2[10] = '\0';
strftime(buf1, sizeof(buf1), "%a %b %d %Y", localtime(&(k->player.time.birth)));
strftime(buf2, sizeof(buf2), "%a %b %d %Y", localtime(&(k->player.time.logon)));
send_to_char(ch, "Created: [%s], Last Logon: [%s], Played [%dh %dm], Age [%d]\r\n",
buf1, buf2, k->player.time.played / 3600,
((k->player.time.played % 3600) / 60), age(k)->year);
send_to_char(ch, "Created: [%s], Last Logon: [%s]\r\n", buf1, buf2);
send_to_char(ch, "STL[%d]/per[%d]/NSTL[%d]",
GET_PRACTICES(k), int_app[GET_INT(k)].learn,
send_to_char(ch, "Played: [%dh %dm], Age: [%d], STL[%d]/per[%d]/NSTL[%d]",
k->player.time.played / 3600, (k->player.time.played % 3600) / 60,
age(k)->year, GET_PRACTICES(k), int_app[GET_INT(k)].learn,
wis_app[GET_WIS(k)].bonus);
/* Display OLC zone for immorts. */
if (GET_LEVEL(k) >= LVL_BUILDER) {
@@ -1766,7 +1764,7 @@ ACMD(do_wizlock)
ACMD(do_date)
{
char *tmstr;
char timestr[25];
time_t mytime;
int d, h, m;
@@ -1775,18 +1773,17 @@ ACMD(do_date)
else
mytime = boot_time;
tmstr = (char *) asctime(localtime(&mytime));
*(tmstr + strlen(tmstr) - 1) = '\0';
strftime(timestr, sizeof(timestr), "%c", localtime(&mytime));
if (subcmd == SCMD_DATE)
send_to_char(ch, "Current machine time: %s\r\n", tmstr);
send_to_char(ch, "Current machine time: %s\r\n", timestr);
else {
mytime = time(0) - boot_time;
d = mytime / 86400;
h = (mytime / 3600) % 24;
m = (mytime / 60) % 60;
send_to_char(ch, "Up since %s: %d day%s, %d:%02d\r\n", tmstr, d, d == 1 ? "" : "s", h, m);
send_to_char(ch, "Up since %s: %d day%s, %d:%02d\r\n", timestr, d, d == 1 ? "" : "s", h, m);
}
}
@@ -1977,6 +1974,7 @@ void list_llog_entries(struct char_data *ch)
FILE *fp;
struct last_entry llast;
int i;
char timestr[25];
if(!(fp=fopen(LAST_FILE,"r"))) {
log("bad things.");
@@ -1985,9 +1983,11 @@ void list_llog_entries(struct char_data *ch)
send_to_char(ch, "Last log\r\n");
i = fread(&llast, sizeof(struct last_entry), 1, fp);
strftime(timestr, sizeof(timestr), "%a %b %d %Y %H:%M:%S", localtime(&llast.time));
while(!feof(fp)) {
send_to_char(ch, "%10s\t%d\t%s\t%s", llast.username, llast.punique,
last_array[llast.close_type], ctime(&llast.time));
send_to_char(ch, "%10s\t%d\t%s\t%s\r\n", llast.username, llast.punique,
last_array[llast.close_type], timestr);
i = fread(&llast, sizeof(struct last_entry), 1, fp);
}
}
@@ -2005,12 +2005,13 @@ static struct char_data *is_in_game(long idnum) {
ACMD(do_last)
{
char arg[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH];
char arg[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH], timestr[25], to[6];
char deltastr[6];
time_t delta;
struct char_data *vict = NULL;
struct char_data *temp;
int recs, i, num = 0;
FILE *fp;
time_t delta;
struct last_entry mlast;
*name = '\0';
@@ -2018,7 +2019,7 @@ ACMD(do_last)
if (*argument) { /* parse it */
half_chop(argument, arg, argument);
while (*arg) {
if ((*arg == '*') && (GET_LEVEL(ch) == LVL_IMPL)) {
if ((*arg == '*' || !strcmp(arg, "all")) && (GET_LEVEL(ch) == LVL_IMPL)) {
list_llog_entries(ch);
return;
}
@@ -2043,11 +2044,12 @@ ACMD(do_last)
return;
}
send_to_char(ch, "[%5ld] [%2d %s] %-12s : %-18s : %-20s\r\n",
strftime(timestr, sizeof(timestr), "%a %b %d %H:%M:%S %Y", localtime(&(vict->player.time.logon)));
send_to_char(ch, "[%5ld] [%2d %s] %-12s : %-18s : %-24s\r\n",
GET_IDNUM(vict), (int) GET_LEVEL(vict),
class_abbrevs[(int) GET_CLASS(vict)], GET_NAME(vict),
GET_HOST(vict) && *GET_HOST(vict) ? GET_HOST(vict) : "(NOHOST)",
ctime(&vict->player.time.logon));
GET_HOST(vict) && *GET_HOST(vict) ? GET_HOST(vict) : "(NOHOST)", timestr);
free_char(vict);
return;
}
@@ -2069,15 +2071,18 @@ ACMD(do_last)
i = fread(&mlast,sizeof(struct last_entry),1,fp);
fseek(fp,-1*((long)sizeof(struct last_entry)),SEEK_CUR);
if(!*name ||(*name && !str_cmp(name, mlast.username))) {
send_to_char(ch,"%10.10s %20.20s %16.16s - ",
mlast.username, mlast.hostname, ctime(&mlast.time));
strftime(timestr, sizeof(timestr), "%a %b %d %Y %H:%M", localtime(&mlast.time));
send_to_char(ch,"%10.10s %20.20s %20.21s - ",
mlast.username, mlast.hostname, timestr);
if((temp=is_in_game(mlast.idnum)) && mlast.punique == GET_PREF(temp)) {
send_to_char(ch, "Still Playing ");
} else {
send_to_char(ch, "%5.5s ",ctime(&mlast.close_time)+11);
delta=mlast.close_time - mlast.time;
send_to_char(ch, "(%5.5s) ",asctime(gmtime(&delta))+11);
send_to_char(ch, "%s", last_array[mlast.close_type]);
delta = mlast.close_time - mlast.time;
strftime(to, sizeof(to), "%H:%M", localtime(&mlast.close_time));
strftime(deltastr, sizeof(deltastr), "%H:%M", gmtime(&delta));
send_to_char(ch, "%5.5s (%5.5s) %s", to, deltastr,
last_array[mlast.close_type]);
}
send_to_char(ch, "\r\n");
@@ -2543,7 +2548,9 @@ ACMD(do_show)
break;
/* show player */
case 2:
case 2: {
char buf1[64], buf2[64];
if (!*value) {
send_to_char(ch, "A name would help.\r\n");
return;
@@ -2558,22 +2565,24 @@ ACMD(do_show)
free_char(vict);
return;
}
strftime(buf1, sizeof(buf1), "%a %b %d %H:%M:%S %Y", localtime(&(vict->player.time.birth)));
strftime(buf2, sizeof(buf2), "%a %b %d %H:%H:%S %Y", localtime(&(vict->player.time.logon)));
send_to_char(ch, "Player: %-12s (%s) [%2d %s]\r\n", GET_NAME(vict),
genders[(int) GET_SEX(vict)], GET_LEVEL(vict), class_abbrevs[(int)
GET_CLASS(vict)]);
send_to_char(ch, "Au: %-8d Bal: %-8d Exp: %-8d Align: %-5d Lessons: %-3d\r\n",
GET_GOLD(vict), GET_BANK_GOLD(vict), GET_EXP(vict),
GET_ALIGNMENT(vict), GET_PRACTICES(vict));
/* ctime() uses static buffer: do not combine. */
send_to_char(ch, "Started: %-20.16s ", ctime(&vict->player.time.birth));
send_to_char(ch, "Last: %-20.16s Played: %3dh %2dm\r\n",
ctime(&vict->player.time.logon),
send_to_char(ch, "Gold: %-8d Bal: %-8d Exp: %-8d Align: %-5d Lessons: %-3d\r\n",
GET_GOLD(vict), GET_BANK_GOLD(vict), GET_EXP(vict),
GET_ALIGNMENT(vict), GET_PRACTICES(vict));
send_to_char(ch, "Started: %-25.25s Last: %-25.25s\r\n", buf1, buf2);
send_to_char(ch, "Played: %dh %dm\r\n",
(int) (vict->player.time.played / 3600),
(int) (vict->player.time.played / 60 % 60));
free_char(vict);
break;
}
/* show rent */
case 3:
if (!*value) {
@@ -4412,7 +4421,7 @@ ACMD(do_file)
ACMD(do_changelog)
{
time_t rawtime;
char tmstr[MAX_INPUT_LENGTH], line[READ_SIZE], last_buf[READ_SIZE],
char timestr[12], line[READ_SIZE], last_buf[READ_SIZE],
buf[READ_SIZE];
FILE *fl, *new;
@@ -4452,9 +4461,9 @@ ACMD(do_changelog)
}
rawtime = time(0);
strftime(tmstr, sizeof(tmstr), "%b %d %Y", localtime(&rawtime));
strftime(timestr, sizeof(timestr), "%b %d %Y", localtime(&rawtime));
sprintf(buf, "[%s] - %s", tmstr, GET_NAME(ch));
sprintf(buf, "[%s] - %s", timestr, GET_NAME(ch));
fprintf(new, "%s\n", buf);
fprintf(new, " %s\n", argument);
@@ -4476,7 +4485,7 @@ ACMD(do_changelog)
ACMD(do_plist)
{
int i, len = 0, count = 0;
char mode, buf[MAX_STRING_LENGTH * 20], name_search[MAX_NAME_LENGTH], time_str[MAX_STRING_LENGTH];
char mode, buf[MAX_STRING_LENGTH * 20], name_search[MAX_NAME_LENGTH], timestr[MAX_STRING_LENGTH];
struct time_info_data time_away;
int low = 0, high = LVL_IMPL, low_day = 0, high_day = 10000, low_hr = 0, high_hr = 24;
@@ -4549,12 +4558,11 @@ ACMD(do_plist)
if (time_away.hours > high_hr || time_away.hours < low_hr)
continue;
strcpy(time_str, asctime(localtime(&player_table[i].last)));
time_str[strlen(time_str) - 1] = '\0';
strftime(timestr, sizeof(timestr), "%c", localtime(&player_table[i].last));
len += snprintf(buf + len, sizeof(buf) - len, "[%3ld] (%2d) %c%-15s %s\r\n",
player_table[i].id, player_table[i].level,
UPPER(*player_table[i].name), player_table[i].name + 1, time_str);
UPPER(*player_table[i].name), player_table[i].name + 1, timestr);
count++;
}
snprintf(buf + len, sizeof(buf) - len, "%s-------------------------------------%s\r\n"
@@ -4949,7 +4957,7 @@ void free_recent_players(void)
ACMD(do_recent)
{
time_t ct;
char *tmstr, arg[MAX_INPUT_LENGTH];
char timestr[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
int hits = 0, limit = 0, count = 0;
struct recent_player *this;
bool loc;
@@ -4962,9 +4970,9 @@ ACMD(do_recent)
}
if (GET_LEVEL(ch) >= LVL_GRGOD) { /* If High-Level Imm, then show Host IP */
send_to_char(ch, " ID | DATE/TIME | HOST IP | Player Name\r\n");
send_to_char(ch, " ID | DATE/TIME | HOST IP | Player Name\r\n");
} else {
send_to_char(ch, " ID | DATE/TIME | Player Name\r\n");
send_to_char(ch, " ID | DATE/TIME | Player Name\r\n");
}
this = recent_list;
@@ -4973,8 +4981,8 @@ ACMD(do_recent)
loc = FALSE;
hits++;
ct = this->time;
tmstr = asctime(localtime(&ct));
*(tmstr + strlen(tmstr) - 1) = '\0'; /* Cut off last char */
strftime(timestr, sizeof(timestr), "%a %b %d %H:%M:%S %Y", localtime(&ct));
if (this->host && *(this->host)) {
if (!strcmp(this->host, "localhost")) loc = TRUE;
}
@@ -4984,21 +4992,21 @@ ACMD(do_recent)
if (GET_LEVEL(ch) >= LVL_GRGOD) /* If High-Level Imm, then show Host IP */
{
if (this->new_player == TRUE) {
send_to_char(ch, "%3d | %-19.19s | %s%-37s%s | %s %s(New Player)%s\r\n", this->vnum, tmstr, loc ? QRED : "", this->host, QNRM, this->name, QYEL, QNRM);
send_to_char(ch, "%3d | %-24.24s | %s%-32s%s | %s %s(New Player)%s\r\n", this->vnum, timestr, loc ? QRED : "", this->host, QNRM, this->name, QYEL, QNRM);
} else if (this->copyover_player == TRUE) {
send_to_char(ch, "%3d | %-19.19s | %s%-37s%s | %s %s(Copyover)%s\r\n", this->vnum, tmstr, loc ? QRED : "", this->host, QNRM, this->name, QCYN, QNRM);
send_to_char(ch, "%3d | %-24.24s | %s%-32s%s | %s %s(Copyover)%s\r\n", this->vnum, timestr, loc ? QRED : "", this->host, QNRM, this->name, QCYN, QNRM);
} else {
send_to_char(ch, "%3d | %-19.19s | %s%-37s%s | %s\r\n", this->vnum, tmstr, loc ? QRED : "", this->host, QNRM, this->name);
send_to_char(ch, "%3d | %-24.24s | %s%-32s%s | %s\r\n", this->vnum, timestr, loc ? QRED : "", this->host, QNRM, this->name);
}
}
else
{
if (this->new_player == TRUE) {
send_to_char(ch, "%3d | %-19.19s | %s %s(New Player)%s\r\n", this->vnum, tmstr, this->name, QYEL, QNRM);
send_to_char(ch, "%3d | %-24.24s | %s %s(New Player)%s\r\n", this->vnum, timestr, this->name, QYEL, QNRM);
} else if (this->copyover_player == TRUE) {
send_to_char(ch, "%3d | %-19.19s | %s %s(Copyover)%s\r\n", this->vnum, tmstr, this->name, QCYN, QNRM);
send_to_char(ch, "%3d | %-24.24s | %s %s(Copyover)%s\r\n", this->vnum, timestr, this->name, QCYN, QNRM);
} else {
send_to_char(ch, "%3d | %-19.19s | %s\r\n", this->vnum, tmstr, this->name);
send_to_char(ch, "%3d | %-24.24s | %s\r\n", this->vnum, timestr, this->name);
}
}
count++;
@@ -5012,9 +5020,8 @@ ACMD(do_recent)
}
ct = time(0); /* Grab the current time */
tmstr = asctime(localtime(&ct));
*(tmstr + strlen(tmstr) - 1) = '\0';
send_to_char(ch, "Current Server Time: %-19.19s\r\nShowing %d players since last copyover/reboot\r\n", tmstr, hits);
strftime(timestr, sizeof(timestr), "%c", localtime(&ct));
send_to_char(ch, "Current Server Time: %s\r\nShowing %d players since last copyover/reboot\r\n", timestr, hits);
}

View File

@@ -118,7 +118,7 @@ static void write_ban_list(void)
return;
}
#define BAN_LIST_FORMAT "%-25.25s %-8.8s %-10.10s %-16.16s\r\n"
#define BAN_LIST_FORMAT "%-25.25s %-8.8s %-15.15s %-16.16s\r\n"
ACMD(do_ban)
{
char flag[MAX_INPUT_LENGTH], site[MAX_INPUT_LENGTH], *nextchar;
@@ -144,8 +144,7 @@ ACMD(do_ban)
for (ban_node = ban_list; ban_node; ban_node = ban_node->next) {
if (ban_node->date) {
strlcpy(timestr, asctime(localtime(&(ban_node->date))), 10);
timestr[10] = '\0';
strftime(timestr, sizeof(timestr), "%a %b %d %Y", localtime(&(ban_node->date)));
} else
strcpy(timestr, "Unknown"); /* strcpy: OK (strlen("Unknown") < 16) */

View File

@@ -291,7 +291,7 @@ const char *HCONTROL_FORMAT =
void hcontrol_list_houses(struct char_data *ch, char *arg)
{
int i;
char *timestr, *temp;
char *temp;
char built_on[128], last_pay[128], own_name[MAX_NAME_LENGTH + 1];
if (arg && *arg) {
@@ -315,8 +315,8 @@ void hcontrol_list_houses(struct char_data *ch, char *arg)
return;
}
send_to_char(ch,
"Address Atrium Build Date Guests Owner Last Paymt\r\n"
"------- ------ ---------- ------ ------------ ----------\r\n");
"Address Atrium Build Date Guests Owner Last Paymt\r\n"
"------- ------ --------------- ------ ------------ ---------------\r\n");
for (i = 0; i < num_of_houses; i++) {
/* Avoid seeing <UNDEF> entries from self-deleted people. -gg 6/21/98 */
@@ -324,22 +324,18 @@ void hcontrol_list_houses(struct char_data *ch, char *arg)
continue;
if (house_control[i].built_on) {
timestr = asctime(localtime(&(house_control[i].built_on)));
*(timestr + 10) = '\0';
strlcpy(built_on, timestr, sizeof(built_on));
strftime(built_on, sizeof(built_on), "%a %b %d %Y", localtime(&(house_control[i].built_on)));
} else
strcpy(built_on, "Unknown"); /* strcpy: OK (for 'strlen("Unknown") < 128') */
strcpy(built_on, "Unknown"); /* strcpy: OK */
if (house_control[i].last_payment) {
timestr = asctime(localtime(&(house_control[i].last_payment)));
*(timestr + 10) = '\0';
strlcpy(last_pay, timestr, sizeof(last_pay));
strftime(last_pay, sizeof(last_pay), "%a %b %d %Y", localtime(&(house_control[i].last_payment)));
} else
strcpy(last_pay, "None"); /* strcpy: OK (for 'strlen("None") < 128') */
strcpy(last_pay, "None"); /* strcpy: OK */
/* Now we need a copy of the owner's name to capitalize. -gg 6/21/98 */
strcpy(own_name, temp); /* strcpy: OK (names guaranteed <= MAX_NAME_LENGTH+1) */
send_to_char(ch, "%7d %7d %-10s %2d %-12s %s\r\n",
send_to_char(ch, "%7d %7d %-15s %2d %-12s %s\r\n",
house_control[i].vnum, house_control[i].atrium, built_on,
house_control[i].num_of_guests, CAP(own_name), last_pay);

View File

@@ -453,7 +453,7 @@ static bool is_ibt_logger(IBT_DATA *ibtData, struct char_data *ch)
ACMD(do_ibt)
{
char arg[MAX_STRING_LENGTH], arg2[MAX_STRING_LENGTH];
char buf[MAX_STRING_LENGTH], *arg_text, imp[30];
char buf[MAX_STRING_LENGTH], *arg_text, imp[30], timestr[128];
int i, num_res, num_unres;
IBT_DATA *ibtData, *first_ibt, *last_ibt;
int ano=0;
@@ -516,9 +516,13 @@ ACMD(do_ibt)
if ((GET_LEVEL(ch) < LVL_IMMORT) && (!is_ibt_logger(ibtData, ch))) {
send_to_char(ch, "Sorry but you may only view %ss you have posted yourself.\n\r", ibt_types[subcmd]);
} else {
send_to_char(ch, "%s%s by %s%s\r\n",QCYN, ibt_types[subcmd], QYEL, ibtData->name);
send_to_char(ch, "%sSubmitted: %s%s", QCYN, QYEL, ibtData->dated ? ctime((const time_t*)&ibtData->dated) : "Unknown\r\n");
if (ibtData->dated != 0) {
strftime(timestr, sizeof(timestr), "%c", localtime(&(ibtData->dated)));
} else {
strcpy(timestr, "Unknown");
}
send_to_char(ch, "%sSubmitted: %s%s\r\n", QCYN, QYEL, timestr);
if (GET_LEVEL(ch) >= LVL_IMMORT) {
send_to_char(ch, "%sLevel: %s%d\r\n",QCYN, QYEL, ibtData->level);
send_to_char(ch, "%sRoom : %s%d\r\n",QCYN, QYEL, ibtData->room);

View File

@@ -211,10 +211,9 @@ char *read_delete(long recipient)
if (!record_to_keep)
sprintf(buf, "Mail system error - please report");
else {
char *tmstr, *from, *to;
char timestr[25], *from, *to;
tmstr = asctime(localtime(&record_to_keep->sent_time));
*(tmstr + strlen(tmstr) - 1) = '\0';
strftime(timestr, sizeof(timestr), "%c", localtime(&(record_to_keep->sent_time)));
from = get_name_by_id(record_to_keep->sender);
to = get_name_by_id(record_to_keep->recipient);
@@ -227,7 +226,7 @@ char *read_delete(long recipient)
"\r\n"
"%s",
tmstr,
timestr,
to ? to : "Unknown",
from ? from : "Unknown",
record_to_keep->body ? record_to_keep->body : "No message" );

View File

@@ -778,7 +778,7 @@ void tag_argument(char *argument, char *tag)
* deleted by an immortal, or deleted by the auto-wipe system (if enabled). */
void remove_player(int pfilepos)
{
char filename[MAX_STRING_LENGTH];
char filename[MAX_STRING_LENGTH], timestr[25];
int i;
if (!*player_table[pfilepos].name)
@@ -790,9 +790,10 @@ void remove_player(int pfilepos)
unlink(filename);
}
strftime(timestr, sizeof(timestr), "%c", localtime(&(player_table[pfilepos].last)));
log("PCLEAN: %s Lev: %d Last: %s",
player_table[pfilepos].name, player_table[pfilepos].level,
asctime(localtime(&player_table[pfilepos].last)));
timestr);
player_table[pfilepos].name[0] = '\0';
/* Update index table. */

View File

@@ -196,7 +196,7 @@ int strn_cmp(const char *arg1, const char *arg2, int n)
void basic_mud_vlog(const char *format, va_list args)
{
time_t ct = time(0);
char *time_s = asctime(localtime(&ct));
char timestr[20];
if (logfile == NULL) {
puts("SYSERR: Using log() before stream was initialized!");
@@ -206,9 +206,9 @@ void basic_mud_vlog(const char *format, va_list args)
if (format == NULL)
format = "SYSERR: log() received a NULL format.";
time_s[strlen(time_s) - 1] = '\0';
strftime(timestr, sizeof(timestr), "%b %d %H:%M:%S %Y", localtime(&ct));
fprintf(logfile, "%-15.15s :: ", time_s + 4);
fprintf(logfile, "%-20.20s :: ", timestr);
vfprintf(logfile, format, args);
fputc('\n', logfile);
fflush(logfile);