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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Islamic.pmod:1: + #pike __REAL_VERSION__ +  + //! This is the islamic calendar. Due to some sources, + //! they decide the first day of the new months on a + //! month-to-month basis (sightings of the new moon), + //! so it's probably not @i{that@} accurate. If + //! someone can confirm (or deny) accuracy better than that, + //! please contact me so I can change this statement.   //! - //! module Calendar - //! submodule Islamic + //! It's vaugely based on rules presented in algorithms by + //! Dershowitz, Reingold and Clamen, 'Calendrical Calculations'. + //! It is the same that's used in Emacs calendar mode.   //! - //! This is the islamic calendar. Due to some sources, - //! they decide the first day of the new months on a - //! month-to-month basis (sightings of the new moon), - //! so it's probably not <i>that</i> accurate. If - //! someone can confirm (or deny) accuracy better than that, - //! please contact me so I can change this statement. - //! - //! It's vaugely based on rules presented in algorithms by - //! Dershowitz, Reingold and Clamen, 'Calendrical Calculations'. - //! It is the same that's used in Emacs calendar mode. - //! - //! known bugs: - //! I have currently no idea how the arabic countries - //! count the week. Follow the same rules as ISO - //! for now... The time is also suspicious; the *day* - //! really starts at sunrise (sunset?) and not midnight, - //! the hours of the day is not correct. Also don't know - //! what to call years before 1 - go for "BH"; positive - //! years are "AH", anno Hegirac. - //! + //! @bugs + //! I have currently no idea how the arabic countries + //! count the week. Follow the same rules as @[ISO] + //! for now... The time is also suspicious; the @b{day@} + //! really starts at sunrise (sunset?) and not midnight, + //! the hours of the day is not correct. Also don't know + //! what to call years before 1 - go for "BH"; positive + //! years are "AH", anno Hegirac.    - #pike __REAL_VERSION__ + inherit .YMD:YMD;    - import "."; - inherit YMD:YMD; -  +    #include "constants.h"      string calendar_name() { return "Islamic"; }      private static mixed __initstuff=lambda()   {    f_week_day_shortname_from_number="islamic_week_day_shortname_from_number";    f_week_day_name_from_number="islamic_week_day_name_from_number";    f_year_name_from_number="islamic_year_name_from_number";   
pike.git/lib/modules/Calendar.pmod/Islamic.pmod:85:    case 5: return ({y,m,30,119});    case 6: return ({y,m,29,149});    case 7: return ({y,m,30,178});    case 8: return ({y,m,29,208});    case 9: return ({y,m,30,237});    case 10: return ({y,m,29,267});    case 11: return ({y,m,30,296});    case 12: return ({y,m,29+year_leap_year(y),326});    }    -  error("month out of range\n"); +  error("Month out of range.\n");   }      static array(int) month_from_yday(int y,int yd)   {   // [month,day-of-month,ndays,month-year-day]    int l=year_leap_year(y);       switch (yd)    {    case 1.. 30: return ({ 1,yd, 30, 1});
pike.git/lib/modules/Calendar.pmod/Islamic.pmod:109:    case 119..148: return ({ 5,yd-118,30,119});    case 149..177: return ({ 6,yd-148,29,149});    case 178..207: return ({ 7,yd-177,30,178});    case 208..236: return ({ 8,yd-207,29,208});    case 237..266: return ({ 9,yd-236,30,237});    case 267..295: return ({10,yd-266,29,267});    case 296..325: return ({11,yd-295,30,296});    case 326..: return ({12,yd-326,29+year_leap_year(y),326});    }    -  error("yday out of range\n"); +  error("yday out of range.\n");   }      static array(int) week_from_julian_day(int jd)   {   // [year,week,day-of-week,ndays,week-julian-day]       [int y,int yjd]=year_from_julian_day(jd);    int yday=jd-yjd+1;       int k=4+(yjd-4)%7;