Branch: Tag:

1998-03-12

1998-03-12 21:43:40 by Per Hedbor <ph@opera.com>

Added option to gethrtime() to get nano-second time resolution

Rev: src/builtin_functions.c:1.80

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.79 1998/03/09 23:23:53 grubba Exp $"); + RCSID("$Id: builtin_functions.c,v 1.80 1998/03/12 21:43:40 per Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"
2292:   void f_gethrtime(INT32 args)   {    pop_n_elems(args); +  if(args) +  push_int((INT32)(gethrtime())); +  else    push_int((INT32)(gethrtime()/1000));   }   #else
2300:    struct timeval tv;    pop_n_elems(args);    GETTIMEOFDAY(&tv); +  if(args) +  push_int((INT32)((tv.tv_sec *1000000) + tv.tv_usec)*1000); +  else    push_int((INT32)((tv.tv_sec *1000000) + tv.tv_usec));   }   #endif /* HAVE_GETHRVTIME */
2368:   {    init_operators();    -  add_efun("gethrtime", f_gethrtime,"function(void:int)", OPT_EXTERNAL_DEPEND); +  add_efun("gethrtime", f_gethrtime,"function(int|void:int)", OPT_EXTERNAL_DEPEND);      #ifdef HAVE_GETHRVTIME    add_efun("gethrvtime",f_gethrvtime,"function(void:int)",OPT_EXTERNAL_DEPEND);