X-Git-Url: https://git.karo-electronics.de/?p=oswald.git;a=blobdiff_plain;f=ui%2Fcalendar.c;h=feca174572d13ec97236beb9d3440beba4003bf4;hp=6271e12a43b7edb9ae51561d46cfd02942019e8e;hb=133faed023f55592a87ee1b8dbc74bc4a8917006;hpb=a9be019ac653badc27a55c94b8d50122eadf8c5f diff --git a/ui/calendar.c b/ui/calendar.c index 6271e12..feca174 100644 --- a/ui/calendar.c +++ b/ui/calendar.c @@ -4,9 +4,10 @@ unsigned char is_leap(const unsigned int year) { - // Die Regel lautet: Alles, was durch 4 teilbar ist, ist ein Schaltjahr. - // Es sei denn, das Jahr ist durch 100 teilbar, dann ist es keins. - // Aber wenn es durch 400 teilbar ist, ist es doch wieder eins. + /* the rule is, everything that can be devided by 4 is leap. + * Exception: the year can be devided by 100, then it is not, + * except it canbe devided by 400, then it is again. + */ if ((year % 400) == 0) return 1; @@ -20,11 +21,11 @@ unsigned char is_leap(const unsigned int year) unsigned short days_of_month(const unsigned int uMonat, const unsigned int uJahr) { - // ungült,Jan,Feb,Mrz,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez + // invalid,January,Febuary,March,April,May,June,July,August,September,October,November,December int arrTageImMonat[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; if (uMonat == 2) { - // Februar: Schaltjahr unterscheiden + // Febuary: distinguish leap if (is_leap(uJahr)) return 29; else