From 71e2f1bf2f7a0b6e18f45ae91e18c3610f2a3626 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 26 Sep 2015 13:19:20 -0400 Subject: [PATCH] Date: Removed unused ::easter method - It is duplicated in Dates.cpp. --- src/Date.cpp | 26 -------------------------- src/Date.h | 1 - test/date.t.cpp | 20 +------------------- 3 files changed, 1 insertion(+), 46 deletions(-) diff --git a/src/Date.cpp b/src/Date.cpp index 6f39d6272..4e38b5d0c 100644 --- a/src/Date.cpp +++ b/src/Date.cpp @@ -573,32 +573,6 @@ int Date::length (const std::string& format) return total; } -//////////////////////////////////////////////////////////////////////////////// -time_t Date::easter (int year) -{ - int Y = year; - int a = Y % 19; - int b = Y / 100; - int c = Y % 100; - int d = b / 4; - int e = b % 4; - int f = (b + 8) / 25; - int g = (b - f + 1) / 3; - int h = (19 * a + b - d - g + 15) % 30; - int i = c / 4; - int k = c % 4; - int L = (32 + 2 * e + 2 * i - h - k) % 7; - int m = (a + 11 * h + 22 * L) / 451; - int month = (h + L - 7 * m + 114) / 31; - int day = ((h + L - 7 * m + 114) % 31) + 1; - struct tm t = {0}; - t.tm_isdst = -1; // Requests that mktime determine summer time effect. - t.tm_mday = day; - t.tm_mon = month - 1; - t.tm_year = year - 1900; - return mktime (&t); -} - //////////////////////////////////////////////////////////////////////////////// int Date::month () const { diff --git a/src/Date.h b/src/Date.h index d8291f25a..8553b0850 100644 --- a/src/Date.h +++ b/src/Date.h @@ -70,7 +70,6 @@ public: static bool valid (const int, const int, const int); static bool valid (const int, const int); - static time_t easter (int year); static bool leapYear (int); static int daysInMonth (int, int); static int daysInYear (int); diff --git a/test/date.t.cpp b/test/date.t.cpp index bf1809b0c..76e1d1010 100644 --- a/test/date.t.cpp +++ b/test/date.t.cpp @@ -36,7 +36,7 @@ Context context; //////////////////////////////////////////////////////////////////////////////// int main (int argc, char** argv) { - UnitTest t (211); + UnitTest t (203); // Ensure environment has no influence. unsetenv ("TASKDATA"); @@ -268,24 +268,6 @@ int main (int argc, char** argv) t.is (Date ("5/1/2011", "m/d/Y").dayOfYear (), 121, "dayOfYear (5/1/2011) -> 121"); t.is (Date ("12/31/2011", "m/d/Y").dayOfYear (), 365, "dayOfYear (12/31/2011) -> 365"); - // Easter - Date e1 (Date::easter(1980)); - t.is (e1.toString (), "4/6/1980", "Easter 4/6/1980"); - Date e2 (Date::easter(1995)); - t.is (e2.toString (), "4/16/1995", "Easter 4/16/1995"); - Date e3 (Date::easter(2000)); - t.is (e3.toString (), "4/23/2000", "Easter 4/23/2000"); - Date e4 (Date::easter(2009)); - t.is (e4.toString (), "4/12/2009", "Easter 4/12/2009"); - Date e5 (Date::easter(2010)); - t.is (e5.toString (), "4/4/2010", "Easter 4/4/2010"); - Date e6 (Date::easter(2011)); - t.is (e6.toString (), "4/24/2011", "Easter 4/24/2011"); - Date e7 (Date::easter(2012)); - t.is (e7.toString (), "4/8/2012", "Easter 4/8/2012"); - Date e8 (Date::easter(2020)); - t.is (e8.toString (), "4/12/2020", "Easter 4/12/2020"); - // Relative dates. Date r1 ("today"); t.ok (r1.sameDay (now), "today = now");