[Ecls-list] time bug on win32

Yaroslav Kavenchuk kavenchuk at gmail.com
Fri Oct 19 11:14:02 UTC 2007


ecl from CVS head, mingw

result of any using time function:

 >> (time (+ 5 5))
#<a FLOATING-POINT-INVALID-OPERATI
ON>
Broken at EVAL.No restarts available.
Broken at EVAL.

Patch:

--- src/c/time.d   Tue May 22 15:55:36 2007
+++ src/c/time.d        Fri Oct 19 08:22:34 2007
@@ -84,7 +84,23 @@
        tv->tv_sec = buf.tms_utime / CLK_TCK;
        tv->tv_usec = (buf.tms_utime % CLK_TCK) * 1000000;
 # else
+#  if defined(mingw32) || defined(_MSC_VER)
+        LONGLONG creation_time;
+        LONGLONG exit_time;
+        LONGLONG kernel_time;
+        LONGLONG user_time;
+        if (!GetProcessTimes(GetCurrentProcess(),
+                             &creation_time,
+                             &exit_time,
+                             &kernel_time,
+                             &user_time))
+         FEwin32_error("GetProcessTimes() failed", 0);
+         kernel_time=(kernel_time+user_time)/10000;
+         tv->tv_sec = kernel_time / 1000;
+         tv->tv_usec = (kernel_time % 1000) * 1000;
+#  else
        get_real_time(tv);
+#  endif
 # endif
 #endif
 }


-- 
WBR, Yaroslav Kavenchuk.




More information about the ecl-devel mailing list