ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/time.C
(Generate patch)

Comparing deliantra/server/common/time.C (file contents):
Revision 1.10 by root, Sat Mar 17 22:11:22 2007 UTC vs.
Revision 1.12 by root, Mon Apr 23 19:10:16 2007 UTC

75}; 75};
76 76
77void 77void
78get_tod (timeofday_t * tod) 78get_tod (timeofday_t * tod)
79{ 79{
80 unsigned int todtick = runtime * (1. / RUNTIME_PER_HOUR); 80 unsigned int todtick = (unsigned int)(runtime * (1. / RUNTIME_PER_HOUR));
81 81
82 tod->year = todtick / HOURS_PER_YEAR; 82 tod->year = todtick / HOURS_PER_YEAR;
83 tod->month = todtick / HOURS_PER_MONTH % MONTHS_PER_YEAR; 83 tod->month = todtick / HOURS_PER_MONTH % MONTHS_PER_YEAR;
84 tod->day = todtick % HOURS_PER_MONTH / DAYS_PER_MONTH; 84 tod->day = todtick % HOURS_PER_MONTH / DAYS_PER_MONTH;
85 tod->hour = todtick % HOURS_PER_DAY; 85 tod->hour = todtick % HOURS_PER_DAY;
86 tod->minute = (runtime - todtick * RUNTIME_PER_HOUR) * (60. / RUNTIME_PER_HOUR); 86 tod->minute = (int)((runtime - todtick * RUNTIME_PER_HOUR) * (60. / RUNTIME_PER_HOUR));
87 87
88 tod->dayofweek = tod->day % DAYS_PER_WEEK; 88 tod->dayofweek = tod->day % DAYS_PER_WEEK;
89 tod->weekofmonth = tod->day / WEEKS_PER_MONTH; 89 tod->weekofmonth = tod->day / WEEKS_PER_MONTH;
90 tod->season = min (4, tod->month / 3); 90 tod->season = min (4, tod->month / 3);
91} 91}
92 92
93void 93void
94print_tod (object *op) 94print_tod (object *op)
95{ 95{
96 timeofday_t tod; 96 timeofday_t tod;
97
98 get_tod (&tod); 97 get_tod (&tod);
99 98
100 char todmsg [1024]; 99 char todmsg [1024];
101 100
102 int day = tod.day + 1; 101 int day = tod.day + 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines