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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Time.pmod:976:    {    if (!base) make_base();    if (what->is_ymd)    return base->place(what,force);       error("place: Incompatible type %O\n",what);    }      // --------    + //! method void call_out(function fun,mixed ...args) + //! Creates a call_out to this point in time. +  void call_out(function fun,mixed ...args) +  { +  if (ux-time(1)>10000) +  predef::call_out(call_out,ux-time(1)-100,fun,@args); +  else if (ux-time(1)<0) +  predef::call_out(fun,0,@args); // already +  else +  predef::call_out(fun,-time(ux),@args); +  } +  + // -------- +    // #define TIME_OPERATOR_DEBUG   #ifdef TIME_OPERATOR_DEBUG   #define DEBUG_OVERLOAD_OPERATOR(OP,NAME,IND) \    TimeRange OP(mixed ...args) \    { \    _ind+=IND; \    TimeRange x=::OP(@args); \    _ind=_ind[..sizeof(_ind)-sizeof(IND)-1]; \    werror(_ind+" %O\n",this); \    foreach (args,TimeRange t) werror(_ind+NAME+" %O\n",t); \
pike.git/lib/modules/Calendar.pmod/Time.pmod:1556:    constant is_timeofday_f=1;    constant is_fraction=1;       int ns; // nanoseconds add to s    int len_ns; // nanoseconds length    int len_s; // seconds length      //! method void create()   //! method void create("unixtime",int|float unixtime)   //! method void create("unixtime",int|float unixtime,int|float len) - //! It is possible to create a Fraction in two ways, + //! method void create(int y,int m,int d,int h,int m,int s,int ns) + //! It is possible to create a Fraction in three ways,   //! either "now" with no arguments or - //! from a unix time (as from <tt>time(2)</tt>). + //! from a unix time (as from <tt>time(2)</tt>), + //! or the convenience way from ymd-hms integers.   //!   //! If created from unix time, both the start of the period   //! and the size of the period can be given in floats,   //! both representing seconds. Note that the default   //! float precision in pike is rather low (same as 'float' in C,   //! the 32 bit floating point precision, normally about 7 digits),   //! so beware that the resolution might bite you. (Internally   //! in a Fraction, the representation is an integer.)   //!   //! If created without explicit length, the fraction will always be
pike.git/lib/modules/Calendar.pmod/Time.pmod:1979:    if (len_s || len_ns>inano/1000)    return sprintf("%d.%06d",    len_s,len_ns/1000);    return sprintf("0.%09d",len_ns);    }       float fraction_no()    {    return ns / 1e9;    } +  +  void call_out(function fun,mixed ...args) +  { +  if (ux-time(1)>10000) +  predef::call_out(call_out,ux-time(1)-100,fun,@args); +  else if (ux-time(1)<0) +  predef::call_out(fun,0,@args); // already +  else +  predef::call_out(fun,-time(ux)+ns*1e-9,@args);    } -  + }      //------------------------------------------------------------------------   // global convinience functions   //------------------------------------------------------------------------      //! method TimeofDay now()   //! Give the zero-length time period of the   //! current time.      TimeofDay now()