]> git.tdb.fi Git - libs/core.git/commitdiff
Fix a bug with leap year handling in DateTime::add_days
authorMikko Rasa <tdb@tdb.fi>
Mon, 30 May 2011 19:59:48 +0000 (22:59 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 30 May 2011 19:59:48 +0000 (22:59 +0300)
source/time/datetime.cpp

index d609b2907cc6f1a10f81db862e7154c9d52332bd..415ce40abcdbd9dd7b4e2a61c2ebe995711413cb 100644 (file)
@@ -150,7 +150,7 @@ void DateTime::add_days(int days)
 
        new_year += cycles;
 
-       if((year-fudge)%4+cycles>=4)
+       if((year-fudge)%4+cycles>=4 && (new_year%100>=4 || new_year%400<4))
        {
                // We passed a leap year - decrement days
                if(days==0)