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.13 by root, Wed Apr 25 18:47:49 2007 UTC

32#include <sys/time.h> 32#include <sys/time.h>
33 33
34/* 34/*
35 * Gloabal variables: 35 * Gloabal variables:
36 */ 36 */
37long pticks; 37tick_t pticks;
38 38
39static const char *season_name[5] = { 39static const char *season_name[5] = {
40 "New Year", 40 "New Year",
41 "Growth", 41 "Growth",
42 "Harvest", 42 "Harvest",
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