Esempio n. 1
0
 //to is also included
 inline Days dayRange(Day from, Day to)
 {
     Days days;
     while (from <= to)
     {
         days.push_back(from);
         ++from;
     }
     return days;
 }
Esempio n. 2
0
 //Returns a vector of nr days starting from today, only including mon ... fri
 inline Days workDays(size_t nr)
 {
     Days days;
     auto t = std::time(0);
     auto gt = std::gmtime(&t);
     Day d(gt->tm_year+1900, gt->tm_mon+1, gt->tm_mday);
     int wday = (gt->tm_wday+6)%7;//wday == 0 => monday
     while (days.size() < nr)
     {
         if (wday < 5)
             //mon .. fri
             days.push_back(d);
         ++d;
         wday = (wday+1)%7;
     }
     return days;
 }