aboutsummaryrefslogtreecommitdiffstats
path: root/src/calendar.c
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2010-10-23 10:19:47 +0000
committerFrederic Culot <calcurse@culot.org>2010-10-23 10:19:47 +0000
commit3cad806d3e118eea6d60348e705dd28ac5bb962e (patch)
treedafda61744c812243e9f888406f9e65feeeb42da /src/calendar.c
parent41857b5f8ee858d122788a17eda9bfe455469fe1 (diff)
downloadcalcurse-3cad806d3e118eea6d60348e705dd28ac5bb962e.tar.gz
calcurse-3cad806d3e118eea6d60348e705dd28ac5bb962e.zip
isBissextile() removed and replaced by isleap macro.
Patch submitted by Lukas Fleischer, thanks.
Diffstat (limited to 'src/calendar.c')
-rwxr-xr-xsrc/calendar.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/calendar.c b/src/calendar.c
index c9f5039..085a239 100755
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -1,4 +1,4 @@
-/* $calcurse: calendar.c,v 1.37 2010/03/29 11:48:05 culot Exp $ */
+/* $calcurse: calendar.c,v 1.38 2010/10/23 10:19:47 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -245,12 +245,6 @@ calendar_get_wday (struct date *date)
return t.tm_wday;
}
-static int
-isBissextile (unsigned year)
-{
- return (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0));
-}
-
static unsigned
months_to_days (unsigned month)
{
@@ -271,7 +265,7 @@ ymd_to_scalar (unsigned year, unsigned month, unsigned day)
scalar = day + months_to_days (month);
if (month > 2)
- scalar -= isBissextile (year) ? 1 : 2;
+ scalar -= isleap (year) ? 1 : 2;
year--;
scalar += years_to_days (year);
@@ -323,7 +317,7 @@ draw_monthly_view (struct window *cwin, struct date *current_day,
/* checking the number of days in february */
numdays = days[mo - 1];
- if (2 == mo && isBissextile (yr))
+ if (2 == mo && isleap (yr))
++numdays;
/*
@@ -459,7 +453,7 @@ ISO8601weeknum (const struct tm *t)
dec31ly.tm_mon = 11;
dec31ly.tm_mday = 31;
dec31ly.tm_wday = (jan1day == SUNDAY) ? 6 : jan1day - 1;
- dec31ly.tm_yday = 364 + isBissextile (dec31ly.tm_year + 1900);
+ dec31ly.tm_yday = 364 + isleap (dec31ly.tm_year + 1900);
wnum = ISO8601weeknum (&dec31ly);
}
break;