From bab841bef118a4f89c6bce4ed142617416bb7a37 Mon Sep 17 00:00:00 2001
From: remi cresson <remi.cresson@teledetection.fr>
Date: Fri, 9 Feb 2018 11:32:02 +0000
Subject: [PATCH] FIX: IsInRange function now exact

---
 include/otbDates.h | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/include/otbDates.h b/include/otbDates.h
index ae8d231..e70011b 100644
--- a/include/otbDates.h
+++ b/include/otbDates.h
@@ -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);
-    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) ;
+    return (startDate.julianday <= julianday && julianday <= startDate.julianday + nbOfDays);
   }
 
   int day;
-- 
GitLab