Commit bab841be authored by remi cresson's avatar remi cresson
Browse files

FIX: IsInRange function now exact

parent aa8b5f4c
No related merge requests found
Showing with 3 additions and 8 deletions
+3 -8
...@@ -84,16 +84,11 @@ public: ...@@ -84,16 +84,11 @@ public:
} }
/* /*
* Return true if the date is in the time range given by (startmonth; startday; nbOfDays) * Return true if the date is in the time range given by (starDate, nbOfDays)
*/ */
bool IsInRange(const int& startMonth, const int& startDay, const int& nbOfDays) const bool IsInRange(SingleDate startDate, const int& nbOfDays) const
{ {
SingleDate startDate1(year, startMonth, startDay); return (startDate.julianday <= julianday && julianday <= startDate.julianday + nbOfDays);
SingleDate startDate2(year-1, startMonth, startDay);
// Not very elegant but functional
return (startDate1.julianday <= julianday && julianday <= startDate1.julianday + nbOfDays) ||
(startDate2.julianday <= julianday && julianday <= startDate2.julianday + nbOfDays) ;
} }
int day; int day;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment