39 #include <sys/types.h>
61 "The Season of New Year",
62 "The Season of Growth",
63 "The Season of Harvest",
64 "The Season of Decay",
65 "The Season of the Blizzard",
71 "the Day of the Moon",
72 "the Day of the Bull",
73 "the Day of the Deception",
76 "the Day of the Great Gods",
83 "Month of the Ice Dragon",
84 "Month of the Frost Giant",
87 "Month of the Harvest",
90 "Month of the Dragon",
92 "Month of the Great Infernus",
94 "Month of the Dark Shades",
95 "Month of the Devourers",
97 "Month of the Ancient Darkness",
176 static struct timeval new_time;
181 elapsed_utime = (new_time.tv_sec-
last_time.tv_sec)*1000000+new_time.tv_usec-
last_time.tv_usec;
196 static struct timeval new_time;
197 long sleep_sec, sleep_usec;
201 sleep_sec =
last_time.tv_sec-new_time.tv_sec;
205 while (sleep_usec < 0) {
206 sleep_usec += 1000000;
209 while (sleep_usec > 1000000) {
210 sleep_usec -= 1000000;
216 if (sleep_sec >= 0 && sleep_usec > 0) {
217 static struct timeval sleep_time;
219 sleep_time.tv_sec = sleep_sec;
220 sleep_time.tv_usec = sleep_usec;
223 select(0, NULL, NULL, NULL, &sleep_time);
225 if (sleep_time.tv_sec)
226 Sleep(sleep_time.tv_sec*1000);
227 Sleep((
int)(sleep_time.tv_usec/1000.));
244 new_time.tv_sec*1000000+new_time.tv_usec) {
280 else if (tod->
month < 6)
282 else if (tod->
month < 9)
284 else if (tod->
month < 12)
291 else if (tod->
hour < 8)
293 else if (tod->
hour < 13)
295 else if (tod->
hour < 15)
297 else if (tod->
hour < 20)
299 else if (tod->
hour < 23)
319 "It is %d minute%s past %d o'clock %s, on %s",
320 "It is %d minute%s past %d o'clock %s, on %s",
322 ((tod.
hour%14 == 0) ? 14 : ((tod.
hour)%14)),
323 ((tod.
hour >= 14) ?
"pm" :
"am"),
327 if (day == 1 || ((day%10) == 1 && day > 20))
329 else if (day == 2 || ((day%10) == 2 && day > 20))
331 else if (day == 3 || ((day%10) == 3 && day > 20))
337 "The %d%s Day of the %s, Year %d",
338 "The %d%s Day of the %s, Year %d",
354 int tot = 0, long_count = 0;
355 uint32 maxt = 0, mint = 99999999, i;
363 "Total time:", NULL);
366 "ticks=%d time=%d.%2d",
367 "ticks=%d time=%d.%2d",
371 "avg time=%dms max time=%dms min time=%dms",
372 "avg time=%dms max time=%dms min time=%dms",
377 "ticks longer than max time (%dms) = %d (%d%%)",
378 "ticks longer than max time (%dms) = %d (%d%%)",
384 "Time last %d ticks:",
385 "Time last %d ticks:",
399 "avg time=%dms max time=%dms min time=%dms",
400 "avg time=%dms max time=%dms min time=%dms",
405 "ticks longer than max time (%dms) = %d (%d%%)",
406 "ticks longer than max time (%dms) = %d (%d%%)",
static void log_time(uint32 process_utime)
static uint32 process_max_utime
const char * get_season_name(const int index)
static uint32 process_min_utime
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
const char * get_weekday(const int index)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
static uint32 process_utime_long_count
static uint32 process_utime_save[PBUFLEN]
const char * get_month_name(const int index)
void set_max_time(long t)
static const char *const month_name[MONTHS_PER_YEAR]
void time_info(object *op)
#define QUERY_FLAG(xyz, p)
#define MSG_TYPE_COMMAND_DEBUG
static void print_tod(object *op)
int enough_elapsed_time(void)
static const char *const periodsofday[PERIODS_PER_DAY]
static const char *const weekdays[DAYS_PER_WEEK]
static const char *const season_name[SEASONS_PER_YEAR+1]
void get_tod(timeofday_t *tod)
#define MSG_TYPE_COMMAND_INFO
const char * get_periodofday(const int index)
#define GETTIMEOFDAY(last_time)
static uint32 process_tot_mtime