---
 src/shared/calendarspec.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/shared/calendarspec.c b/src/shared/calendarspec.c
index 64d0dec..73f87c6 100644
--- a/src/shared/calendarspec.c
+++ b/src/shared/calendarspec.c
@@ -24,6 +24,12 @@
 
 #include "calendarspec.h"
 
+#define CENTURY_ONE 1900
+#define CENTURY_TWO 2000
+#define CENTURY_GAP 70
+#define BITS_WEEKDAYS  127
+#define BITS_MONTHS    127
+
 static void free_chain(CalendarComponent *c) {
         CalendarComponent *n;
 
@@ -107,11 +113,11 @@ static void fix_year(CalendarComponent *c) {
         while(c) {
                 CalendarComponent *n = c->next;
 
-                if (c->value >= 0 && c->value < 70)
-                        c->value += 2000;
+                if (c->value >= 0 && c->value < CENTURY_GAP)
+                        c->value += CENTURY_TWO;
 
-                if (c->value >= 70 && c->value < 100)
-                        c->value += 1900;
+                if (c->value >= CENTURY_GAP && c->value < 100)
+                        c->value += CENTURY_ONE;
 
                 c = n;
         }
@@ -157,7 +163,9 @@ _pure_ bool calendar_spec_valid(CalendarSpec *c) {
         if (c->weekdays_bits > 127)
                 return false;
 
-        if (!chain_valid(c->year, 1970, 2199))
+        if (!chain_valid(c->year,
+                       (CENTURY_ONE + CENTURY_GAP),
+                       (CENTURY_TWO + CENTURY_GAP)))
                 return false;
 
         if (!chain_valid(c->month, 1, 12))
@@ -847,9 +855,9 @@ static int find_next(const CalendarSpec *spec, struct tm 
*tm) {
                 mktime(&c);
                 c.tm_isdst = -1;
 
-                c.tm_year += 1900;
+                c.tm_year += CENTURY_ONE;
                 r = find_matching_component(spec->year, &c.tm_year);
-                c.tm_year -= 1900;
+                c.tm_year -= CENTURY_ONE;
 
                 if (r > 0) {
                         c.tm_mon = 0;
-- 
1.9.3

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to