pike.git / lib / modules / Calendar.pmod / Badi.pmod

 version » Context lines: 10204080filenone3

pike.git/lib/modules/Calendar.pmod/Badi.pmod:58:   static int julian_day_from_year(int y)   {    // this would be march 21st, by taking the preceding year we can reuse the    // leapyear calculations from the gregorian calendar    y+=1843;    return 1721426-286+y*365+y/4-y/100+y/400;   }      static int compat_week_day(int n)   { -  // week starts on saturday -  return n-2; +  // this is specific to the gregorian calendar. +  // we just stick with the value as it is +  return n;   }      static array(int) year_month_from_month(int y,int m)   {   // [y,m,ndays,myd]       y+=(m-1)/19;    m=1+(m-1)%19;       switch (m)
pike.git/lib/modules/Calendar.pmod/Badi.pmod:124:    y--;    w=52+( (k==4) || ( (k==5) && year_leap_year(y) ) );    }    else if (w==53 && k>=6-year_leap_year(y) && k<10-year_leap_year(y))    {   // handle the case that the week is in the next year    y++;    w=1;    }    -  return ({y,w,1+(yjd+yday)%7,7,wjd}); +  return ({y,w,1+(1+yjd+yday)%7,7,wjd});   }    - // identical to gregorian +    static array(int) week_from_week(int y,int w)   {   // [year,week,1 (wd),ndays,week-julian-day]       int yjd=julian_day_from_year(y); -  int wjd=-5+yjd-(yjd+3)%7; +  int wjd=-5+yjd-(yjd+4)%7;       if (w<1 || w>52) // may or may not be out of this year    return week_from_julian_day(wjd+w*7);       return ({y,w,1,7,wjd+w*7});   // fixme   }      // identical to gregorian   static int year_remaining_days(int y,int yday)