pike.git
/
lib
/
modules
/
Calendar.pmod
/
YMD.pike
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Calendar.pmod/YMD.pike:2916:
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);
+
what
= String.trim_all_whites(
what);
-
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;
+
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;
+
}
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",