From 9548a89926801e37ebd28f69bb63e6f574402ce3 Mon Sep 17 00:00:00 2001
From: Per Hedbor <ph@opera.com>
Date: Wed, 7 May 1997 08:27:32 +0200
Subject: [PATCH] Two new functions: gethrtime() and gethrvtime(). Returns time
 down to cycle precision on sparcs. Used by gauge

Rev: src/builtin_functions.c:1.36
Rev: src/configure.in:1.93
---
 src/builtin_functions.c | 23 ++++++++++++++++++++++-
 src/configure.in        |  5 ++++-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index b88904a358..2279f3ee24 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: builtin_functions.c,v 1.35 1997/04/16 03:09:09 hubbe Exp $");
+RCSID("$Id: builtin_functions.c,v 1.36 1997/05/07 06:27:32 per Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "pike_macros.h"
@@ -1663,9 +1663,30 @@ void f_replace_master(INT32 args)
   pop_n_elems(args);
 }
 
+#ifdef HAVE_GETHRVTIME
+#include <sys/time.h>
+
+void f_gethrvtime(INT32 args)
+{
+  pop_n_elems(args);
+  push_int((INT32)((gethrvtime())/1000));
+}
+
+void f_gethrtime(INT32 args)
+{
+  pop_n_elems(args);
+  push_int((INT32)((gethrtime())/1000)); 
+}
+#endif
+
 void init_builtin_efuns()
 {
   init_operators();
+
+#ifdef HAVE_GETHRVTIME
+  add_efun("gethrvtime",f_gethrvtime,"function(void:int)",OPT_EXTERNAL_DEPEND);
+  add_efun("gethrtime", f_gethrtime,"function(void:int)", OPT_EXTERNAL_DEPEND);
+#endif
   
   add_efun("_refs",f__refs,"function(function|string|array|mapping|multiset|object|program:int)",OPT_EXTERNAL_DEPEND);
   add_efun("replace_master",f_replace_master,"function(object:void)",OPT_SIDE_EFFECT);
diff --git a/src/configure.in b/src/configure.in
index 3c7b62b936..c56aee0cbc 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1,4 +1,4 @@
-AC_REVISION("$Id: configure.in,v 1.92 1997/04/23 01:59:40 hubbe Exp $")
+AC_REVISION("$Id: configure.in,v 1.93 1997/05/07 06:27:30 per Exp $")
 AC_INIT(interpret.c)
 AC_CONFIG_HEADER(machine.h)
 
@@ -653,6 +653,9 @@ AC_CHECK_FUNCS(
  clock \
  crypt \
  fchmod \
+ gethrtime \
+ gethrvtime \
+ frexp \
  getenv \
  getrlimit \
  getrusage \
-- 
GitLab