summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdMZ.c
diff options
context:
space:
mode:
authordas <das>2006-08-21 01:08:41 (GMT)
committerdas <das>2006-08-21 01:08:41 (GMT)
commitd9504ba9f92205956e0b4aa1fa79e44b10a9d68d (patch)
tree79988284b81c4c2f62215be9b742d8dca444ab1c /generic/tclCmdMZ.c
parentd70383944a28777ea679b1e1b4be38c2a42b3960 (diff)
downloadtcl-d9504ba9f92205956e0b4aa1fa79e44b10a9d68d.zip
tcl-d9504ba9f92205956e0b4aa1fa79e44b10a9d68d.tar.gz
tcl-d9504ba9f92205956e0b4aa1fa79e44b10a9d68d.tar.bz2
* generic/tclClock.c (ClockClicksObjCmd): add support for Darwin
* generic/tclCmdMZ.c (Tcl_TimeObjCmd): nanosecond resolution timer * generic/tclInt.h: to [clock clicks] and [time] * unix/configure.in (Darwin): when TCL_WIDE_CLICKS defined. * unix/tclUnixTime.c (TclpGetWideClicks, TclpWideClicksToNanoseconds): * unix/configure: autoconf-2.59 * unix/tclConfig.h.in: autoheader-2.59
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r--generic/tclCmdMZ.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index d955691..a77431c 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdMZ.c,v 1.134 2005/12/19 19:03:16 dgp Exp $
+ * RCS: @(#) $Id: tclCmdMZ.c,v 1.135 2006/08/21 01:08:41 das Exp $
*/
#include "tclInt.h"
@@ -2921,7 +2921,11 @@ Tcl_TimeObjCmd(dummy, interp, objc, objv)
register int i, result;
int count;
double totalMicroSec;
+#ifndef TCL_WIDE_CLICKS
Tcl_Time start, stop;
+#else
+ Tcl_WideInt start, stop;
+#endif
if (objc == 2) {
count = 1;
@@ -2937,17 +2941,25 @@ Tcl_TimeObjCmd(dummy, interp, objc, objv)
objPtr = objv[1];
i = count;
+#ifndef TCL_WIDE_CLICKS
Tcl_GetTime(&start);
+#else
+ start = TclpGetWideClicks();
+#endif
while (i-- > 0) {
result = Tcl_EvalObjEx(interp, objPtr, 0);
if (result != TCL_OK) {
return result;
}
}
+#ifndef TCL_WIDE_CLICKS
Tcl_GetTime(&stop);
-
- totalMicroSec = (((double) (stop.sec - start.sec))*1.0e6
- + (stop.usec - start.usec));
+ totalMicroSec = ((double) (stop.sec - start.sec))*1.0e6
+ + (stop.usec - start.usec);
+#else
+ stop = TclpGetWideClicks();
+ totalMicroSec = ((double) TclpWideClicksToNanoseconds(stop - start))/1.0e3;
+#endif
if (count <= 1) {
/*
@@ -2961,7 +2973,7 @@ Tcl_TimeObjCmd(dummy, interp, objc, objv)
/*
* Construct the result as a list because many programs have always parsed
- * at such (extracting the first element, typically).
+ * as such (extracting the first element, typically).
*/
objs[1] = Tcl_NewStringObj("microseconds", -1);