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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Timezone.pmod:502:    }       int `==(Shift other)    {    return ( dayrule==other->dayrule &&    time==other->time &&    timetype==other->timetype &&    offset==other->offset &&    s==other->s );    } -  function(Shift:int) __equal=`==; +  int __equal (Shift other) {return `== (other);}       constant wday=(["Mon":1,"Tue":2,"Wed":3,"Thu":4,"Fri":5,"Sat":6,"Sun":7]);    constant vmonth=(<"Jan","Feb","Mar","Apr","May","Jun",    "Jul","Aug","Sep","Nov","Dec">);       string think_day(string mon,string rule)    {    int d;    string ds;   
pike.git/lib/modules/Calendar.pmod/Timezone.pmod:1278:   // Base "Timezone with rules" class   // ----------------------------------------------------------------       class TZRules    {    constant is_timezone=1;    constant is_dst_timezone=1;    static int offset_to_utc;    string name;    -  static function(string:string) tzformat; +     static array names;         // ----------------------------------------------------------------   // all rules are based on the gregorian calendar, so   // this is the needed gregorian rule:   // ----------------------------------------------------------------       static array gregorian_yjd(int jd)    {
pike.git/lib/modules/Calendar.pmod/Timezone.pmod:1306:    int y=century*100+century_year+1;       return    ({    y,    1721426+century_year*365+century_year/4+century_jd,    (!(((y)%4) || (!((y)%100) && ((y)%400))))    });    }    +  static string tzformat (string s) +  { +  if (names) +  { +  if (s=="") return names[0]; else return names[1]; +  } +  else +  return sprintf(name,s); +  } +     static void create(int offset,string _name)    {    offset_to_utc=offset;    name=_name;    if (search(name,"/")!=-1)    {    names=name/"/"; -  tzformat=lambda(string s) -  { -  if (s=="") return names[0]; else return names[1]; -  }; +     } -  else -  tzformat=lambda(string s) { return sprintf(name,s); }; +     }      // the Rule:   // which julian day does dst start and end this year?    static array(array(string|int)) jd_year_periods(int jd);      // is (midnight) this julian day dst?    array tz_jd(int jd)    {    array(array(string|int)) a=jd_year_periods(jd);