15 int start_of_year_first_work_week = Jan_1_JDN - ( ( Jan_1_JDN + 1 ) % 7 );
16 int start_of_other_year_first_work_week = other_Jan_1_JDN - ( ( other_Jan_1_JDN + 1 ) % 7 );
18 return ( ( start_of_year_first_work_week - start_of_other_year_first_work_week ) / 7 );
25 if( ( year % 400 == 0 ) || ( year % 4 == 0 && year % 100 != 0 ) )
31 else if( month == 4 || month == 6 || month == 9 || month == 11 )
45 message <<
"Invalid work week given: " << year <<
" doesn't have a work week " << ww;
46 throw std::runtime_error(message.str());
54 auto time = std::localtime( &t );
56 _year = time->tm_year + 1900;
58 int Jan_1_wday = ( time->tm_wday - time->tm_yday ) % 7;
61 _ww = ( ( time->tm_yday + Jan_1_wday ) / 7 ) + 1;
65 if(
_ww == 53 && ( 31 - time->tm_mday ) < ( 6 - time->tm_wday ) )
89 auto t = std::time(
nullptr );
101 unsigned jdn(
unsigned year,
unsigned month,
unsigned day )
103 if (month == 0 || day == 0 || month > 12 || day >
days_in_month(year, month))
106 message <<
"Invalid date given: " << day <<
"/" << month <<
"/" << year;
107 throw std::runtime_error(message.str());
109 return ( ( 1461 * ( year + 4800 + ( ( (
int)month - 14 ) / 12 ) ) ) / 4 )
110 + ( ( 367 * ( month - 2 - ( 12 * ( ( (
int)month - 14 ) / 12 ) ) ) ) / 12 )
111 - ( ( 3 * ( ( year + 4900 + ( ( (
int)month - 14 ) / 12 ) ) / 100 ) ) / 4 ) + day - 32075;
GLenum GLuint GLenum GLsizei const GLchar * message
static int work_weeks_between_years(unsigned year, unsigned other_year)
unsigned get_year() const
unsigned get_work_weeks_since(const work_week &start)
work_week(unsigned year, unsigned ww)
int operator-(const work_week &ww) const
static unsigned days_in_month(unsigned year, unsigned month)
static work_week current()
unsigned get_work_week() const
unsigned jdn(unsigned year, unsigned month, unsigned day)