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:2452:
//! %y dwim year (70-99 is 1970-1999, 0-69 is 2000-2069) //! %M month (number, name or short name) (needs %y) //! %W week (needs %y) //! %D date (needs %y, %m) //! %d short date (20000304, 000304) //! %a day (needs %y) //! %e weekday (needs %y, %w) //! %h hour (needs %d, %D or %W) //! %m minute (needs %h) //! %s second (needs %m)
-
//! %f fraction of a second (needs %s)
+
//! %
S seconds since the Epoch (only combines with %
f
)
+
//!
%f
fraction of a second (needs %s
or %S
)
//! %t short time (205314, 2053) //! %z zone //! %p "am" or "pm" //! %n empty string (to be put at the end of formats) //! </pre> //! //! returns 0 if format doesn't match data, or the appropriate time object. //! //! note: //! The zone will be a guess if it doesn't state an exact
pike.git/lib/modules/Calendar.pmod/YMD.pike:2585:
if (!nfmt) { // nfmt=replace(fmt," %","%*[ \t]%"); // whitespace -> whitespace #define ALNU "%[^- -,./:-?[-`{-¿]" #define AMPM "%[ampAMP.]" #define NUME "%[0-9]" #define ZONE "%[-+0-9A-Za-z/]" nfmt=replace(fmt, ({"%Y","%y","%M","%W","%D","%a","%e","%h","%m","%s","%p",
-
"%t","%f","%d","%z","%n"}),
+
"%t","%f","%d","%z","%n"
,"%S"
}),
({ALNU,ALNU,ALNU,"%d",NUME,"%d",ALNU,"%d","%d","%d",AMPM,
-
NUME,NUME,NUME,ZONE,"%s"}));
+
NUME,NUME,NUME,ZONE,"%s"
,"%d"
}));
#if 1 q=array_sscanf(fmt,"%{%*[^%]%%%1s%}")*({})*({})-({"*","%"}); #else // slower alternatives: array q=Array.map(replace(fmt,({"%*","%%"}),({"",""}))/"%", lambda(string s){ return s[..0];})-({""}); array q=({}); array pr=(array)fmt;
pike.git/lib/modules/Calendar.pmod/YMD.pike:2765:
break; default: return 0; // need "am" or "pm" } } if (m->z) // zone low = dwim_zone(low,m->z,g,h,mi,s); else if (g) low = dwim_tod(low,g,h,mi,s);
+
else if (!zero_type(m->S))
+
low = Second(m->S);
if (sub_second) low = low->fraction(sub_second); return low; #ifndef NOCATCH }) #endif return 0; }