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:1009:
from=0.0,to=n; else error("Illegal arguments\n"); if (from<0.0) from=0.0; if (to>n) to=n; return ({Fraction("timeofday_f",rules,unix_time(),0, (int)to,(int)(inano*(to-(int)to))) ->autopromote()}); }
+
TimeRange `*(int|float n)
+
{
+
if(intp(n))
+
return set_size(n,this);
+
else
+
return second()*(int)(how_many(Second)*n);
+
}
+
+
array(TimeRange) split(int|float n, void|function|TimeRange with)
+
{
+
if(!with)
+
with=Second();
+
else if (functionp(with))
+
with=promote_program(with);
+
+
int length=(int)(how_many(with)/n);
+
+
TimeRange start=beginning();
+
TimeRange end=end();
+
array result=({});
+
while(start+with*length < end)
+
{
+
result += ({ start->distance(start+with*length) });
+
start=start+with*length;
+
}
+
result += ({ start->distance(end) });
+
return result;
+
}
+
// ---------------------------------------- // virtual functions needed // ---------------------------------------- string nice_print(); string _sprintf(int t,mapping m) { switch (t) { case 't':