From 1cd1a0e185ba31cf89c72dcecbd15c7a5b3b7060 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 30 May 2011 22:59:48 +0300 Subject: [PATCH] Fix a bug with leap year handling in DateTime::add_days --- source/time/datetime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- 2.45.2