Go to the documentation of this file.
28 #include <sys/types.h>
52 "The Season of New Year",
53 "The Season of Growth",
54 "The Season of Harvest",
55 "The Season of Decay",
56 "The Season of the Blizzard",
62 "the Day of the Moon",
63 "the Day of the Bull",
64 "the Day of the Deception",
67 "the Day of the Great Gods",
74 "Month of the Ice Dragon",
75 "Month of the Frost Giant",
78 "Month of the Harvest",
81 "Month of the Dragon",
83 "Month of the Great Infernus",
85 "Month of the Dark Shades",
86 "Month of the Devourers",
88 "Month of the Ancient Darkness",
143 clock_gettime(CLOCK_MONOTONIC, &
game_time);
164 long long sec = (
long long)end->tv_sec - (
long long)start->tv_sec;
165 long nsec = end->tv_nsec - start->tv_nsec;
166 return sec * 1e6 + nsec / 1e3;
173 long nsec_sum = time->tv_nsec + usec * 1e3;
174 time->tv_sec += nsec_sum / 1e9;
175 time->tv_nsec = nsec_sum % (long)1e9;
188 clock_gettime(CLOCK_MONOTONIC, &now);
196 clock_gettime(CLOCK_MONOTONIC, &
game_time);
227 else if (tod->
month < 6)
229 else if (tod->
month < 9)
231 else if (tod->
month < 12)
238 else if (tod->
hour < 8)
240 else if (tod->
hour < 13)
242 else if (tod->
hour < 15)
244 else if (tod->
hour < 20)
246 else if (tod->
hour < 23)
270 if (day == 1 || ((day%10) == 1 && day > 20))
272 else if (day == 2 || ((day%10) == 2 && day > 20))
274 else if (day == 3 || ((day%10) == 3 && day > 20))
280 "The %d%s Day of the %s, Year %d",
295 int tot = 0, long_count = 0;
296 uint32_t maxt = 0, mint = 99999999, i;
305 "Statistics for last %d ticks:\n\tmin/avg/max = %d/%d/%d ms per tick",
311 "\tticks longer than %d ms = %d (%d%%)",
tick_duration / 1000,
315 "Time last %d ticks:",
331 "avg time=%dms max time=%dms min time=%dms",
336 "ticks longer than max time (%dms) = %d (%d%%)",
346 clock_gettime(CLOCK_REALTIME, &now);
367 snprintf(
buf, bufsize,
"%d minute%s past %d o'clock %s",
369 tod->
minute+1 < 2 ?
"" :
"s",
370 tod->
hour%14 == 0 ? 14 : tod->
hour%14,
371 tod->
hour >= 14 ?
"pm" :
"am");
const char * get_month_name(const int index)
void time_info(object *op)
void set_tick_duration(long t)
#define QUERY_FLAG(xyz, p)
static struct timespec game_time
long get_sleep_remaining()
const char * get_periodofday(const int index)
static const char *const weekdays[DAYS_PER_WEEK]
static const char *const month_name[MONTHS_PER_YEAR]
unsigned int tick_length(float seconds)
static const char *const season_name[SEASONS_PER_YEAR+1]
static void print_tod(object *op)
static const char *const periodsofday[PERIODS_PER_DAY]
#define MSG_TYPE_COMMAND_DEBUG
void get_tod(timeofday_t *tod)
#define MSG_TYPE_COMMAND_INFO
static uint32_t process_max_utime
long timespec_diff(struct timespec *end, struct timespec *start)
static uint32_t process_utime_long_count
static void timespec_add(struct timespec *time, long usec)
static void log_time(uint32_t process_utime)
static uint32_t process_min_utime
const char * get_season_name(const int index)
static uint32_t process_utime_save[PBUFLEN]
static uint32_t process_tot_mtime
const char * get_weekday(const int index)
const char * time_format_time(const timeofday_t *tod, char *buf, size_t bufsize)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)