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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Gregorian.pmod:1: - //! - //! module Calendar - //! submodule Gregorian - //! - //! This is the standard conservative christian calendar, - //! used regularly in some countries - USA, for instance - and - //! which derivate - <ref>the ISO calendar</ref> - is used - //! in most of europe. - //! -  +    #pike __REAL_VERSION__    - import "."; - inherit YMD:YMD; + //! This is the standard conservative christian calendar, + //! used regularly in some countries - USA, for instance - and + //! which derivate - the @[ISO] calendar - is used in most of + //! Europe.    -  + inherit .YMD:YMD; +    #include "constants.h"      string calendar_name() { return "Gregorian"; }      private static mixed __initstuff=lambda()   {    f_week_day_shortname_from_number="gregorian_week_day_shortname_from_number";    f_week_day_name_from_number="gregorian_week_day_name_from_number";    f_year_name_from_number="gregorian_year_name_from_number";    f_week_day_number_from_name="gregorian_week_day_number_from_name";
pike.git/lib/modules/Calendar.pmod/Gregorian.pmod:81:    case 5: return ({y,m,31,121+year_leap_year(y)});    case 6: return ({y,m,30,152+year_leap_year(y)});    case 7: return ({y,m,31,182+year_leap_year(y)});    case 8: return ({y,m,31,213+year_leap_year(y)});    case 9: return ({y,m,30,244+year_leap_year(y)});    case 10: return ({y,m,31,274+year_leap_year(y)});    case 11: return ({y,m,30,305+year_leap_year(y)});    case 12: return ({y,m,31,335+year_leap_year(y)});    }    -  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]    if (yd<1) return ({12,31+yd,32,335+year_leap_year(y-1)});    int l=year_leap_year(y);    if (yd<32) return ({1,yd,31,1});    yd-=l;    switch (yd)
pike.git/lib/modules/Calendar.pmod/Gregorian.pmod:105:    case 91..120: return ({4,yd-90,30 ,91+year_leap_year(y)});    case 121..151: return ({5,yd-120,31 ,121+year_leap_year(y)});    case 152..181: return ({6,yd-151,30 ,152+year_leap_year(y)});    case 182..212: return ({7,yd-181,31 ,182+year_leap_year(y)});    case 213..243: return ({8,yd-212,31 ,213+year_leap_year(y)});    case 244..273: return ({9,yd-243,30 ,244+year_leap_year(y)});    case 274..304: return ({10,yd-273,31,274+year_leap_year(y)});    case 305..334: return ({11,yd-304,30,305+year_leap_year(y)});    case 335..365: return ({12,yd-334,31,335+year_leap_year(y)});    } -  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;