Atrinik Server  4.0
Macros | Functions | Variables
time.c File Reference
#include <global.h>

Go to the source code of this file.

Macros

#define PBUFLEN   100
 

Functions

void reset_sleep (void)
 
static void log_time (long process_utime)
 
void sleep_delta (void)
 
void set_max_time (long t)
 
void set_max_time_multiplier (int t)
 
void get_tod (timeofday_t *tod)
 
void print_tod (object *op)
 
void time_info (object *op)
 
long seconds (void)
 

Variables

long max_time = MAX_TIME
 
int max_time_multiplier = MAX_TIME_MULTIPLIER
 
static long process_utime_save [PBUFLEN]
 
static long psaveind
 
static long process_max_utime = 0
 
static long process_min_utime = 999999999
 
static long process_tot_mtime
 
long pticks
 
static long process_utime_long_count
 
struct timeval last_time
 
const char * season_name [SEASONS_PER_YEAR]
 
const char * weekdays [DAYS_PER_WEEK]
 
const char * month_name [MONTHS_PER_YEAR]
 
const char * periodsofday [PERIODS_PER_DAY]
 
const int periodsofday_hours [HOURS_PER_DAY]
 

Detailed Description

In-game time functions.

Definition in file time.c.

Macro Definition Documentation

#define PBUFLEN   100

Size of history buffer.

Definition at line 36 of file time.c.

Function Documentation

void get_tod ( timeofday_t tod)

Computes the in-game time of the day.

Parameters
todWhere to store information. Must not be NULL.

Definition at line 279 of file time.c.

static void log_time ( long  process_utime)
static

Adds time to our history list.

Definition at line 150 of file time.c.

void print_tod ( object op)

Prints the time.

Parameters
opPlayer who requested time.

Definition at line 301 of file time.c.

void reset_sleep ( void  )

Initialize all variables used in the timing routines.

Definition at line 130 of file time.c.

long seconds ( void  )

Gets the seconds.

Returns
Seconds.

Definition at line 338 of file time.c.

void set_max_time ( long  t)

Sets the max speed. Can be called by a DM through the /speed command.

Parameters
tNew speed.

Definition at line 239 of file time.c.

void set_max_time_multiplier ( int  t)

Sets the max speed multiplier.

Parameters
tNew speed multiplier.

Definition at line 259 of file time.c.

void sleep_delta ( void  )

Checks how much time has elapsed since last tick. If it is less than max_time, the remaining time is slept with select().

Definition at line 174 of file time.c.

void time_info ( object op)

Players wants to know the time. Called through the /time command.

Parameters
opPlayer who requested time.

Definition at line 328 of file time.c.

Variable Documentation

struct timeval last_time

Used for main loop timing.

Definition at line 50 of file time.c.

const char* month_name[MONTHS_PER_YEAR]
Initial value:
= {
"Month of the Winter",
"Month of the Ice Dragon",
"Month of the Frost Giant",
"Month of Terria",
"Month of the Harvest",
"Month of Futility",
"Month of the Dragon",
"Month of the Sun",
"Month of the Falling",
"Month of the Dark Shades",
"Month of the Great Infernus",
"Month of the Ancient Darkness",
}

Months.

Definition at line 72 of file time.c.

const char* periodsofday[PERIODS_PER_DAY]
Initial value:
= {
"midnight",
"late night",
"dawn",
"morning",
"late morning",
"noon",
"afternoon",
"dusk",
"evening",
"night"
}

Periods of day.

Definition at line 88 of file time.c.

const int periodsofday_hours[HOURS_PER_DAY]
Initial value:
= {
0,
1, 1, 1, 1,
2,
3, 3, 3, 3,
4, 4,
5,
6, 6, 6, 6, 6,
7,
8, 8, 8,
9, 9
}

Period of the day at each hour in the day.

Definition at line 104 of file time.c.

long process_max_utime = 0
static

Longest cycle time.

Definition at line 43 of file time.c.

long process_min_utime = 999999999
static

Shortest cycle time.

Definition at line 45 of file time.c.

long process_utime_save[PBUFLEN]
static

Historic data.

Definition at line 39 of file time.c.

long psaveind
static

Index in process_utime_save.

Definition at line 41 of file time.c.

const char* season_name[SEASONS_PER_YEAR]
Initial value:
= {
"Season of the Blizzard",
"Season of Growth",
"Season of Harvest",
"Season of Decay",
}

In-game seasons.

Definition at line 53 of file time.c.

const char* weekdays[DAYS_PER_WEEK]
Initial value:
= {
"Day of the Moon",
"Day of the Bull",
"Day of the Deception",
"Day of Thunder",
"Day of Freedom",
"Day of the Great Gods",
"Day of the Sun"
}

Days of the week.

Definition at line 61 of file time.c.