Branch: Tag:

2000-10-10

2000-10-10 11:20:37 by Mirar (Pontus Hagland) <pike@sort.mirar.org>

changed the dwim of time formats slightly

Rev: lib/modules/Calendar.pmod/YMD.pmod:1.13

2350:    string nfmt;       nfmt=replace(fmt," %","%*[ \t]%"); // whitespace -> whitespace - #define ALNU "%[^ -,./:-?[-`{-¿]" + #define ALNU "%[^- -,./:-?[-`{-¿]"   #define AMPM "%[ampAMP]"   #define NUME "%[0-9]"    nfmt=replace(nfmt,
2582:    "%y-%M-%D",    "-%y%*[ /]%D%*[ /]%M",    "-%y%*[ /]%M%*[ /]%D", -  "%y%*[ /]%D%*[ /]%M", +     "%y%*[ /]%M%*[ /]%D", -  +  "%y%*[ /]%D%*[ /]%M",    "%D%*[- /]%M",    "%M%*[- /]%D",    "%e%*[- /wv]%W%*[ -/]%y",
2629:    string a,h,m,s;    TimeofDay t;    -  foreach ( ({ " %z","%z",""}), -  string zone ) -  foreach ( ({ "%t", +  foreach ( dwim_day_strings + +  ({""}), +  string dayformat ) +  foreach ( ({ "%t %z", +  "T%t %z",    "T%t", -  +  "%h:%*[ :]%m%*[ :]%s %p %z",    "%h:%*[ :]%m%*[ :]%s %p", -  +  "%h:%*[ :]%m%*[ :]%s %z", +  "%h:%*[ :]%m%*[ :]%s%z",    "%h:%*[ :]%m%*[ :]%s", -  +  "%h:%*[ :]%m %p %z",    "%h:%*[ :]%m %p", -  +  "%h:%*[ :]%m %z", +  "%h:%*[ :]%m%z",    "%h:%*[ :]%m",    "%h%*[ ]%p", -  +  "%[a-zA-Z.] %h:%*[ :]%m%*[ :]%s %p %z",    "%[a-zA-Z.] %h:%*[ :]%m%*[ :]%s %p", -  +  "%[a-zA-Z.] %h:%*[ :]%m%*[ :]%s %z", +  "%[a-zA-Z.] %h:%*[ :]%m%*[ :]%s%z",    "%[a-zA-Z.] %h:%*[ :]%m%*[ :]%s", -  +  "%[a-zA-Z.] %h:%*[ :]%m %p %z",    "%[a-zA-Z.] %h:%*[ :]%m %p", -  +  "%[a-zA-Z.] %h:%*[ :]%m %z", +  "%[a-zA-Z.] %h:%*[ :]%m%z",    "%[a-zA-Z.] %h:%*[ :]%m",    "%[a-zA-Z.] %h%*[ ]%p", }),    string todformat ) -  foreach ( dwim_day_strings + -  ({""}), -  string dayformat ) +     { -  if ( (t=parse(dayformat+"%*[ ,]"+todformat+zone,what)) ) return t; -  if ( (t=parse(todformat+zone+"%*[ ,]"+dayformat,what)) ) return t; + // werror("try: %O\n %O\n", + // dayformat+"%*[ ,]"+todformat, + // todformat+"%*[ ,]"+dayformat); +  if ( (t=parse(dayformat+"%*[ ,]"+todformat,what)) ) return t; +  if ( (t=parse(todformat+"%*[ ,]"+dayformat,what)) ) return t;    }       error("Failed to dwim time from %O\n",what);