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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/YMD.pmod:2507:   // 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 (origin->rules->abbr2zone[zonename])    zonename=origin->rules->abbr2zone[zonename];       Ruleset.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);    if (!tr) return 0;
pike.git/lib/modules/Calendar.pmod/YMD.pmod:2877:    error("Failed to dwim day from %O\n",day);   }      TimeofDay dwim_time(string what,void|TimeRange cx)   {    string a,h,m,s;    TimeofDay t;      // #define COLON "$*[ :]"   #define COLON ":" + #define SPACED(X) replace(X," ","%*[ ]")       sscanf(what,"%*[ \t]%s",what);    -  if (t=parse("%e %M %D %h:%m:%s %Y",what,cx)) return t; // ctime -  if (t=parse("%e %M %D %h:%m:%s %z %Y",what,cx)) return t; +  if (t=parse(SPACED("%e %M %D %h:%m:%s %Y"),what,cx)) return t; // ctime +  if (t=parse(SPACED("%e %M %D %h:%m:%s %z %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",