summaryrefslogtreecommitdiffstats
path: root/generic/tclClock.c
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2017-02-09 11:36:17 (GMT)
committersebres <sebres@users.sourceforge.net>2017-02-09 11:36:17 (GMT)
commitfb811680f60f0555a27685601c519ff931956593 (patch)
tree1fd7d26262a58c457148ba5448a9339c3d92771a /generic/tclClock.c
parent1ff982ffd6785745b647bbe0bb46aca7e13ace8e (diff)
downloadtcl-fb811680f60f0555a27685601c519ff931956593.zip
tcl-fb811680f60f0555a27685601c519ff931956593.tar.gz
tcl-fb811680f60f0555a27685601c519ff931956593.tar.bz2
[timerate] bug fix: missing scale conversion by Mac OSX on platform where high resolution clicks are not microseconds based;
[win] use high resolution timer for the wide clicks and microseconds directly, prevent several forwards/backwards conversions; [win, unix, mac-osx] normalize some functions for common usage in different time units (clicks, micro- and nanoseconds)
Diffstat (limited to 'generic/tclClock.c')
-rw-r--r--generic/tclClock.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 27009fd..5da9511 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -1760,8 +1760,7 @@ ClockClicksObjCmd(
#endif
break;
case CLICKS_MICROS:
- Tcl_GetTime(&now);
- clicks = ((Tcl_WideInt) now.sec * 1000000) + now.usec;
+ clicks = TclpGetMicroseconds();
break;
}
@@ -1831,15 +1830,11 @@ ClockMicrosecondsObjCmd(
int objc, /* Parameter count */
Tcl_Obj *const *objv) /* Parameter values */
{
- Tcl_Time now;
-
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
}
- Tcl_GetTime(&now);
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
- ((Tcl_WideInt) now.sec * 1000000) + now.usec));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclpGetMicroseconds()));
return TCL_OK;
}