@@ -3432,28 +3432,26 @@ ClockParseFmtScnArgs(
3432
3432
/* Base (by scan or add) or clock value (by format) */
3433
3433
3434
3434
if (opts -> baseObj != NULL ) {
3435
- register Tcl_Obj * baseObj = opts -> baseObj ;
3436
- /* bypass integer recognition if looks like option "-now" */
3437
- if (
3438
- ( baseObj -> length == 4 && baseObj -> bytes && * ( baseObj -> bytes + 1 ) == 'n' ) ||
3439
- TclGetWideIntFromObj ( NULL , baseObj , & baseVal ) != TCL_OK
3440
- ) {
3441
-
3442
- /* we accept "-now" as current date-time */
3435
+ Tcl_Obj * baseObj = opts -> baseObj ;
3436
+
3437
+ /* bypass integer recognition if looks like "now" or "-now" */
3438
+ if (( baseObj -> bytes &&
3439
+ (( baseObj -> length == 3 && baseObj -> bytes [ 0 ] == 'n' ) ||
3440
+ ( baseObj -> length == 4 && baseObj -> bytes [ 1 ] == 'n' )))
3441
+ || TclGetWideIntFromObj ( NULL , baseObj , & baseVal ) != TCL_OK ) {
3442
+ /* we accept "now" and " -now" as current date-time */
3443
3443
static const char * const nowOpts [] = {
3444
- "-now" , NULL
3444
+ "now" , " -now" , NULL
3445
3445
};
3446
3446
int idx ;
3447
- if (Tcl_GetIndexFromObj (NULL , baseObj , nowOpts , "seconds or -now" ,
3448
- TCL_EXACT , & idx ) == TCL_OK
3449
- ) {
3447
+ if (Tcl_GetIndexFromObj (NULL , baseObj , nowOpts , "seconds" ,
3448
+ TCL_EXACT , & idx ) == TCL_OK ) {
3450
3449
goto baseNow ;
3451
3450
}
3452
3451
3453
3452
Tcl_SetObjResult (interp , Tcl_ObjPrintf (
3454
- "expected integer but got \"%s\"" ,
3455
- Tcl_GetString (baseObj )));
3456
- Tcl_SetErrorCode (interp , "TCL" , "VALUE" , "INTEGER" , NULL );
3453
+ "bad seconds \"%s\": must be now or integer" ,
3454
+ TclGetString (baseObj )));
3457
3455
i = 1 ;
3458
3456
goto badOption ;
3459
3457
}
@@ -3550,9 +3548,8 @@ ClockFormatObjCmd(
3550
3548
int objc , /* Parameter count */
3551
3549
Tcl_Obj * const objv []) /* Parameter values */
3552
3550
{
3553
- ClockClientData * dataPtr = clientData ;
3554
-
3555
- static const char * syntax = "clock format clockval|-now "
3551
+ ClockClientData * dataPtr = (ClockClientData * )clientData ;
3552
+ static const char * syntax = "clock format clockval|now "
3556
3553
"?-format string? "
3557
3554
"?-gmt boolean? "
3558
3555
"?-locale LOCALE? ?-timezone ZONE?" ;
@@ -4398,7 +4395,7 @@ ClockAddObjCmd(
4398
4395
int objc , /* Parameter count */
4399
4396
Tcl_Obj * const objv []) /* Parameter values */
4400
4397
{
4401
- static const char * syntax = "clock add clockval|- now ?number units?..."
4398
+ static const char * syntax = "clock add clockval|now ?number units?..."
4402
4399
"?-gmt boolean? "
4403
4400
"?-locale LOCALE? ?-timezone ZONE?" ;
4404
4401
ClockClientData * dataPtr = clientData ;
0 commit comments