pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:3188:    */      /*! @class Time    *!    *! The current time as a structure containing a sec and a usec    *! member.    */   PIKECLASS Time   {    CVAR int hard_update; +  struct pike_string *sec, *usec, *usec_full;       /*! @decl int sec;    *! @decl int usec;    *!    *! The number of seconds and microseconds since the epoch and the    *! last whole second, respectively. (See also @[predef::time()])    *!    *! Please note that these variables will continually update when    *! they are requested, there is no need to create new Time()    *! objects.
pike.git/src/builtin.cmod:3210:    /*! @decl int usec_full;    *!    *! The number of microseconds since the epoch. Please note that    *! pike has to have been compiled with bignum support for this    *! variable to contain sensible values.    */       PIKEFUN int `->( string x )    {    extern struct timeval current_time; -  struct pike_string *usec; -  struct pike_string *sec, *usec_full; +     -  MAKE_CONST_STRING( sec, "sec" ); -  MAKE_CONST_STRING( usec, "usec" ); -  MAKE_CONST_STRING (usec_full, "usec_full"); -  +     if( !x ) {    push_undefined();    return;    }       if( THIS->hard_update )    GETTIMEOFDAY( &current_time );       if( x == usec )    RETURN current_time.tv_usec;
pike.git/src/builtin.cmod:3252:   #else    RETURN (current_time.tv_sec * 1000000 + current_time.tv_usec);   #endif    }       PIKEFUN int `[]( string x )    {    f_Time_cq__backtick_2D_3E( args );    }    +  PIKEFUN array(string) _indices() +  { +  push_string(sec); +  push_string(usec); +  push_string(usec_full); +  f_aggregate(3); +  } +  +  PIKEFUN array(int) _values() +  { +  ref_push_string(sec); +  f_Time_cq__backtick_2D_3E(1); +  ref_push_string(usec); +  f_Time_cq__backtick_2D_3E(1); +  ref_push_string(usec_full); +  f_Time_cq__backtick_2D_3E(1); +  f_aggregate(3); +  } +     /*! @decl protected void create( int fast );    *!    *! If @[fast] is true, do not request a new time from the system,    *! instead use the global current time variable.    *!    *! This will only work in callbacks, but can save significant amounts    *! of CPU.    */    PIKEFUN void create( int|zero|void fast )    {    THIS->hard_update = !fast;    } -  +  +  INIT +  { +  MAKE_CONST_STRING( sec, "sec" ); +  MAKE_CONST_STRING( usec, "usec" ); +  MAKE_CONST_STRING( usec_full, "usec_full");    }    -  +  EXIT +  { +  free_string(sec); +  free_string(usec); +  free_string(usec_full); +  } +  + } +    /*! @endclass    */      /*! @class Timer    */   PIKECLASS Timer   {    CVAR struct timeval last_time;    CVAR int hard_update;