/* Since the code for the time command is screwed up out of the box, I dug up
the code from Rom and merged it. Some IMHO useless info was dropped. Just replace
the entire do_time function and recompile*/
Do_Fun(do_time)
{
getcurrenttime();
char *suf;
int day;
if (!NullStr(argument))
{
CharData *victim;
if ((victim = get_char_world(ch, argument)) == NULL || IsNPC(victim))
{
chprintln(ch, "There is no such player.");
return;
}
if (GetTzone(victim) == -1)
{
act("$N doesn't have a time zone set.", ch, NULL, victim,
TO_CHAR);
return;
}
act("{W$N's local time is $t.{x", ch,
str_time(-1, GetTzone(victim), NULL), victim, TO_CHAR);
return;
}
day = time_info.day + 1;
if ( day > 4 && day < 20 ) suf = "th";
else if ( day % 10 == 1 ) suf = "st";
else if ( day % 10 == 2 ) suf = "nd";
else if ( day % 10 == 3 ) suf = "rd";
else suf = "th";
chprintlnf(ch,
"It is %d o'clock %s, Day of %s, %d%s of the Month of %s, year %d.",
(time_info.hour % 12 == 0) ? 12 : time_info.hour %12,
time_info.hour >= 12 ? "pm" : "am",
day_name[day % 7],
day, suf,
month_name[time_info.month], time_info.year);
chprintlnf(ch,"%s started up at %s, which was %s ago. The system time is %s.",
mud_info.name, str_time(boot_time, -1, NULL), timestr(current_time - boot_time, false), str_time(-1, -1, NULL));;
return;
}