int main() { printf("%d\n", previous_day(Monday)); printf("%d\n", next_day(Sunday)); printf("%d %d", increment_day(Thursday, 4), increment_day(Monday, -4)); return 0; }
TimeWithDate& TimeWithDate::operator-= (time_t t) { t -= this->seconds(); int d = 0; while(t < 0) { d++; t += SECS_IN_A_DAY; } for (int i = 0; i < d; ++i) previous_day(); return *this = TimeWithDate(year, month, day, t); }