From cbbff87767447b7ed2d22028c5c8a8ed9983c7a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Sun, 31 Oct 1999 16:29:51 +0100
Subject: [PATCH] gethr{,v}time() now knows about INT64.

Rev: src/builtin_functions.c:1.198
---
 src/builtin_functions.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index 3e9acf24b8..85b5df3e0c 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: builtin_functions.c,v 1.197 1999/10/29 03:35:31 mast Exp $");
+RCSID("$Id: builtin_functions.c,v 1.198 1999/10/31 15:29:51 grubba Exp $");
 #include "interpret.h"
 #include "svalue.h"
 #include "pike_macros.h"
@@ -3813,16 +3813,16 @@ void f_master(INT32 args)
 void f_gethrvtime(INT32 args)
 {
   pop_n_elems(args);
-  push_int((INT32)(gethrvtime()/1000));
+  push_int64(gethrvtime()/1000);
 }
 
 void f_gethrtime(INT32 args)
 {
   pop_n_elems(args);
   if(args)
-    push_int((INT32)(gethrtime())); 
+    push_int64(gethrtime()); 
   else
-    push_int((INT32)(gethrtime()/1000)); 
+    push_int64(gethrtime()/1000);
 }
 #else
 void f_gethrtime(INT32 args)
@@ -3830,10 +3830,17 @@ void f_gethrtime(INT32 args)
   struct timeval tv;
   pop_n_elems(args);
   GETTIMEOFDAY(&tv);
+#ifdef INT64
   if(args)
-    push_int((INT32)((tv.tv_sec *1000000) + tv.tv_usec)*1000);
+    push_int64((((INT64)tv.tv_sec * 1000000) + tv.tv_usec)*1000);
   else
-    push_int((INT32)((tv.tv_sec *1000000) + tv.tv_usec));
+    push_int64(((INT64)tv.tv_sec * 1000000) + tv.tv_usec));
+#else /* !INT64 */
+  if(args)
+    push_int64(((tv.tv_sec * 1000000) + tv.tv_usec)*1000);
+  else
+    push_int64((tv.tv_sec * 1000000) + tv.tv_usec));
+#endif /* INT64 */
 }
 #endif /* HAVE_GETHRVTIME */
 
-- 
GitLab