MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / getFirstDayOfCurrentWeek

Method getFirstDayOfCurrentWeek

game/state/gametime.cpp:143–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143unsigned 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
162unsigned int GameTime::getLastDayOfCurrentWeek() const
163{

Callers 1

updateEndOfDayMethod · 0.80

Calls 1

getPtimeFunction · 0.85

Tested by

no test coverage detected