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.11 by root, Sat Mar 17 22:32:15 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}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines