[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kdecore
From:       Meni Livne <livne () kde ! org>
Date:       2003-09-14 10:05:02
[Download RAW message or body]

CVS commit by livne: 

Fix hndays with leap years.


  M +3 -12     kcalendarsystemhebrew.cpp   1.33


--- kdelibs/kdecore/kcalendarsystemhebrew.cpp  #1.32:1.33
@@ -222,5 +222,5 @@ static int hebrewDaysInYear(int y)
 static int long_cheshvan(int year)
 {
-  return ((hebrewDaysInYear(year) % 10) == 5);
+  return (((hebrewDaysInYear(year + 1) - hebrewDaysInYear(year)) % 10) == 5);
 }
 
@@ -231,5 +231,5 @@ static int long_cheshvan(int year)
 static int short_kislev(int year)
 {
-  return ((hebrewDaysInYear(year) % 10) == 3);
+  return (((hebrewDaysInYear(year + 1) - hebrewDaysInYear(year)) % 10) == 3);
 }
 
@@ -479,19 +479,10 @@ int KCalendarSystemHebrew::daysInMonth(c
 }
 
-// ### HPB: This is incorrect
 int KCalendarSystemHebrew::hndays(int mon, int year) const
 {
-  if ( is_leap_year(year) )
-    if ( mon == 6 )
-      mon = 13;
-    else if ( mon == 7 )
-      mon = 14;
-    else
-      --mon;
-
   if( mon == 8 /*IYYAR*/ || mon == 10 /*TAMUZ*/ ||
     mon == 12 /*ELUL*/ || mon == 4 /*TEVET*/ ||
     mon == 14 /*ADAR 2*/||
-    ( mon == 13 /*ADAR 1*/ && !is_leap_year(year)) /*!leap*/||
+    ( mon == 6 /*ADAR*/ && !is_leap_year(year)) ||
     (mon ==  2 /*CHESHVAN*/ && !long_cheshvan(year)) ||
     (mon == 3 /*KISLEV*/ && short_kislev(year)))


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic