ecere/sys/Date: OnCompare method (optimization)
authorJerome St-Louis <jerome@ecere.com>
Wed, 9 Dec 2015 23:12:31 +0000 (18:12 -0500)
committerJerome St-Louis <jerome@ecere.com>
Mon, 21 Dec 2015 19:07:29 +0000 (14:07 -0500)
ecere/src/sys/Date.ec

index c869d55..cb541d0 100644 (file)
@@ -92,6 +92,17 @@ public struct Date
    Month month;
    int day;
 
+   int OnCompare(Date b)
+   {
+      if(year > b.year) return 1;
+      if(year < b.year) return -1;
+      if(month > b.month) return 1;
+      if(month < b.month) return -1;
+      if(day > b.day) return 1;
+      if(day < b.day) return -1;
+      return 0;
+   }
+
    const char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
    {
       if(stringOutput)