pike.git/
src/
builtin_functions.c
Branch:
Tag:
Non-build tags
All tags
No tags
1998-07-15
1998-07-15 20:16:47 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>
d0e6742d3448a1a17caaa89471bfb26adcb1cb2a (
21
lines) (+
18
/-
3
)
[
Show
|
Annotate
]
Branch:
7.9
added float precision functionality to time()
Rev: src/builtin_functions.c:1.115
4:
||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h"
-
RCSID("$Id: builtin_functions.c,v 1.
114
1998/07/
12
19
:
57
:47
mast
Exp $");
+
RCSID("$Id: builtin_functions.c,v 1.
115
1998/07/
15
20
:
16
:47
hubbe
Exp $");
#include "interpret.h" #include "svalue.h" #include "pike_macros.h"
701:
void f_time(INT32 args) {
-
pop_n_elems(args);
+
if(!args)
-
+
{
GETTIMEOFDAY(¤t_time);
-
+
}else{
+
if(sp[-args].type == T_INT && sp[-args].u.integer > 1)
+
{
+
struct timeval tmp;
+
GETTIMEOFDAY(¤t_time);
+
tmp.tv_sec=sp[-args].u.integer;
+
tmp.tv_usec=0;
+
my_subtract_timeval(&tmp,¤t_time);
+
pop_n_elems(args);
+
push_float( - (float)tmp.tv_sec - ((float)tmp.tv_usec)/1000000 );
+
return;
+
}
+
}
+
pop_n_elems(args);
push_int(current_time.tv_sec); }
3014:
add_efun("stringp", f_stringp, "function(mixed:int)",0); add_efun("this_object", f_this_object, "function(:object)",OPT_EXTERNAL_DEPEND); add_efun("throw",f_throw,"function(mixed:void)",OPT_SIDE_EFFECT);
-
add_efun("time",f_time,"function(void|int:int)",OPT_EXTERNAL_DEPEND);
+
add_efun("time",f_time,"function(void|int:int
|float
)",OPT_EXTERNAL_DEPEND);
add_efun("trace",f_trace,"function(int:int)",OPT_SIDE_EFFECT); add_function("transpose",f_transpose,"function(array(0=mixed):array(0))", 0); add_efun("upper_case",f_upper_case,"function(string:string)",0);