pike.git/
src/
builtin.cmod
Branch:
Tag:
Non-build tags
All tags
No tags
2011-02-15
2011-02-15 16:15:51 by Martin Nilsson <nilsson@opera.com>
c329cb54802b889b551aa2d799f97a0b49800766 (
44
lines) (+
37
/-
7
)
[
Show
|
Annotate
]
Branch:
7.9
Perhaps the right way to add indices to Time.
3195:
PIKECLASS Time { CVAR int hard_update;
+
struct pike_string *sec, *usec, *usec_full;
/*! @decl int sec; *! @decl int usec;
3217:
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;
3259:
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,
3271:
{ 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 */