diff options
| author | sebres <sebres@users.sourceforge.net> | 2017-02-09 11:36:17 (GMT) |
|---|---|---|
| committer | sebres <sebres@users.sourceforge.net> | 2017-02-09 11:36:17 (GMT) |
| commit | ca98340c4c69feed95b1823e8a83800a1ea8fae3 (patch) | |
| tree | 1fd7d26262a58c457148ba5448a9339c3d92771a /generic/tclClock.c | |
| parent | 35539e2f98f007de63a0bef192a769c9f8f9ad91 (diff) | |
| download | tcl-ca98340c4c69feed95b1823e8a83800a1ea8fae3.zip tcl-ca98340c4c69feed95b1823e8a83800a1ea8fae3.tar.gz tcl-ca98340c4c69feed95b1823e8a83800a1ea8fae3.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.c | 9 |
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; } |
