| 141 | } |
| 142 | |
| 143 | unsigned int GameTime::getFirstDayOfCurrentWeek() const |
| 144 | { |
| 145 | const date today = getPtime(this->ticks).date(); |
| 146 | |
| 147 | // The boost library calculates the first day of the week as Sunday (day_of_week = 0) |
| 148 | // The game instead consider it as Monday (day_of_week = 1) |
| 149 | if (today.day_of_week() == 1) // Monday |
| 150 | return today.year_month_day().day; |
| 151 | else |
| 152 | { |
| 153 | unsigned short days_to_monday = today.day_of_week() - 1; |
| 154 | if (today.day_of_week() == 0) // Sunday |
| 155 | days_to_monday = 6; |
| 156 | |
| 157 | const date first_day_of_week = today - days(days_to_monday); |
| 158 | return first_day_of_week.year_month_day().day; |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | unsigned int GameTime::getLastDayOfCurrentWeek() const |
| 163 | { |
no test coverage detected