tools/source/datetime/tdate.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
New commits: commit ae838de0a3840e0fd490db5447bd6d481616e9d7 Author: Michael Meeks <michael.me...@collabora.com> Date: Thu Feb 20 21:26:20 2014 +0000 fdo#66507 - accelerate date calculations as used vs. empty cells. Change-Id: I5cd642db4e0595c96e1af8adf7c7a45f589a259e diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 719219a..720692b 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -33,7 +33,7 @@ struct tm *localtime_r(const time_t *timep, struct tm *buffer); #endif static const sal_uInt16 aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30, - 31, 31, 30, 31, 30, 31 }; + 31, 31, 30, 31, 30, 31 }; #define MAX_DAYS 3636532 @@ -195,7 +195,7 @@ sal_uInt16 Date::GetDayOfYear() const } sal_uInt16 Date::GetWeekOfYear( DayOfWeek eStartDay, - sal_Int16 nMinimumNumberOfDaysInWeek ) const + sal_Int16 nMinimumNumberOfDaysInWeek ) const { short nWeek; short n1WDay = (short)Date( 1, 1, GetYear() ).GetDayOfWeek(); @@ -407,6 +407,10 @@ Date& Date::operator +=( long nDays ) sal_uInt16 nDay; sal_uInt16 nMonth; sal_uInt16 nYear; + + if (nDays == 0) + return *this; + long nTempDays = DateToDays( GetDay(), GetMonth(), GetYear() ); nTempDays += nDays; @@ -428,6 +432,10 @@ Date& Date::operator -=( long nDays ) sal_uInt16 nDay; sal_uInt16 nMonth; sal_uInt16 nYear; + + if (nDays == 0) + return *this; + long nTempDays = DateToDays( GetDay(), GetMonth(), GetYear() ); nTempDays -= nDays; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits