summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2003-02-01 21:27:55 (GMT)
committerKevin B Kenny <kennykb@acm.org>2003-02-01 21:27:55 (GMT)
commit2186d565ba4e59be880114e0330457cc9143c2d4 (patch)
treef7a72eb5e68ad525b2295b75f172ec476cd10ab5 /generic
parentba1f1f1fd02bbc394411bd61da4b5dcf87439b60 (diff)
downloadtcl-2186d565ba4e59be880114e0330457cc9143c2d4.zip
tcl-2186d565ba4e59be880114e0330457cc9143c2d4.tar.gz
tcl-2186d565ba4e59be880114e0330457cc9143c2d4.tar.bz2
* generic/tclClock.c: Fixed a bug that incorrectly allowed
[clock clicks {}] and [clock clicks -] to be accepted as if they were [clock clicks -milliseconds]. * tests/clock.test: Added regression tests for the above bug. [Bug 675356]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclClock.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c
index e98eba6..55c3bab 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclClock.c,v 1.19 2003/02/01 19:48:23 kennykb Exp $
+ * RCS: @(#) $Id: tclClock.c,v 1.20 2003/02/01 21:27:55 kennykb Exp $
*/
#include "tcl.h"
@@ -66,6 +66,7 @@ Tcl_ClockObjCmd (client, interp, objc, objv)
long zone;
Tcl_Obj *baseObjPtr = NULL;
char *scanStr;
+ int n;
static CONST char *switches[] =
{"clicks", "format", "scan", "seconds", (char *) NULL};
@@ -90,9 +91,10 @@ Tcl_ClockObjCmd (client, interp, objc, objv)
int forceMilli = 0;
if (objc == 3) {
- format = Tcl_GetStringFromObj(objv[2], &index);
- if (strncmp(format, "-milliseconds",
- (unsigned int) index) == 0) {
+ format = Tcl_GetStringFromObj(objv[2], &n);
+ if ( ( n >= 2 )
+ && ( strncmp( format, "-milliseconds",
+ (unsigned int) n) == 0 ) ) {
forceMilli = 1;
} else {
Tcl_AppendStringsToObj(resultPtr,