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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/YMD.pike:769:    if (sizeof(mp)) m=mp[0];    else m=1;       if (m==-1 && !n)    return Day("ymd_yd",rules,y,yjd,jd,yd,1);       if (m<0) m+=1+number_of_days();       array(TimeRange) res=days(m,m);    if (sizeof(res)==1) return res[0]; -  error("not in range (Day 1..%d exist)\n", +  if(number_of_days()) +  error("Not in range (Day 1..%d exist).\n",    number_of_days()); -  +  else +  error("No days in object.\n");    }      // --- months       int number_of_months();       array(cMonth) months(int ...range)    {    int from=1,n=number_of_months(),to=n;   
pike.git/lib/modules/Calendar.pmod/YMD.pike:2534:   // dwim timezone and call dwim time of day above   // this API may change without further notice   static TimeRange dwim_zone(TimeRange origin,string zonename,    string whut,int ...args)   {    if (zonename=="") return 0;       if (zonename[0]=='"') sscanf(zonename,"\"%s\"",zonename);    sscanf(zonename,"%*[ \t]%s",zonename);    -  // Ugly fix for synonyms. This suppport should of course be -  // added in a lower layer when the next refactoring occurs. -  zonename = ([ "MEST":"CET", "MESZ":"CET" ])[zonename] || zonename; +  if(sizeof(zonename)==4 && zonename[2]=='S') +  zonename = zonename[0..1] + zonename[3..3]; +  else if(sizeof(zonename)>4 && has_suffix(zonename, "DST")) +  zonename = zonename[..sizeof(zonename)-1-3];       if (origin->rules->abbr2zone[zonename])    zonename=origin->rules->abbr2zone[zonename];       .Rule.Timezone zone=.Timezone[zonename];    if (!zone)    {    if (sscanf(zonename,"%[^-+]%s",string a,string b)==2 && a!="" && b!="")    {    TimeRange tr=dwim_zone(origin,a,whut,@args);
pike.git/lib/modules/Calendar.pmod/YMD.pike:2923:   #define COLON ":"   #define SPACED(X) replace(X," ","%*[ ]")       what = String.trim_all_whites(what);       if (sizeof(what)>12 &&    (t=parse(SPACED("%e %M %D %h:%m:%s %Y"),what,cx))) return t; // ctime    if (sizeof(what)>15 &&    (t=parse(SPACED("%e %M %D %h:%m:%s %z %Y"),what,cx))) return t;    if (sizeof(what)>19 && -  (t=parse(SPACED("%e %M %D %h:%m:%s %z DST %Y"),what,cx))) { -  string tz = t->tzname(); -  t->set_timezone( tz[..sizeof(tz)-2] + "S" + -  tz[sizeof(tz)-1..sizeof(tz)-1] ); -  return t; -  } +  (t=parse(SPACED("%e %M %D %h:%m:%s %z DST %Y"),what,cx))) return t;       foreach ( dwim_day_strings +    ({""}),    string dayformat )    foreach ( ({ "%t %z",    "T%t %z",    "T%t",    "%h"COLON"%m"COLON"%s %p %z",    "%h"COLON"%m"COLON"%s %p",    "%h"COLON"%m"COLON"%s %z",