From: Mikko Rasa Date: Mon, 30 May 2011 19:59:48 +0000 (+0300) Subject: Fix a bug with leap year handling in DateTime::add_days X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=1cd1a0e185ba31cf89c72dcecbd15c7a5b3b7060;p=libs%2Fcore.git Fix a bug with leap year handling in DateTime::add_days --- diff --git a/source/time/datetime.cpp b/source/time/datetime.cpp index d609b29..415ce40 100644 --- a/source/time/datetime.cpp +++ b/source/time/datetime.cpp @@ -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)