Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2005-02-08
23:35 • Ticket [1118650fff] Problem with function clock status still Closed with 2 o... artifact: 3e2345e928 user: kennykb
23:35 • Closed ticket [1118650fff]. artifact: c94c9e9749 user: kennykb
22:31 • Ticket [1118650fff]: 4 changes artifact: e96dc5165b user: kennykb
14:32 • New ticket [1118650fff]. artifact: 3db6554a45 user: yandres

Problem with function clock

Closed / Wont Fix1118650fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2005-02-08 14:32:26
Following five commands work perfectly with Tcl 8.0 but 
have stopped working with TCL8.3 and 8.4.

set timeCurrent [clock format [clock scan seconds]]
set i 2
set twoDaysAfter [clock format [clock 
scan "$timeCurrent $i days"]]
set i -2
set twoDaysBefore [clock format [clock 
scan "$timeCurrent $i days"]]


The message of Tcl is the following:

"unable to convert date-time string "Tue Feb 08 
14:25:41 GMT 2005 -2 days"
kennykbplain2005-02-08 22:31:31
Logged In: YES 
user_id=99768

I'll have a look at this, but you 
should be aware that there are
so many ambiguities in free-form
[clock scan] that the problem may
not be fixed in the 8.4 series.

A better way to get the same effect 
would be to use the '-base' option on
the [clock scan] command:

set timeCurrent [clock format [clock seconds]]
set i 2
set twoDaysAfter \ 
    [clock scan "$i days" -base $timeCurrent]
set i -2
set twoDaysBefore \
    [clock scan "$i days" -base $timeCurrent]

That should be enough to get your program
running again.
kennykbplain2005-02-08 23:35:01
Logged In: YES 
user_id=99768

This problem is going to be VERY hard to
fix in the 8.4 series - essentially, a YACC
parser is not appropriate to this sort of
thing.  The fixed-format [clock scan] in
8.5 and beyond provides ready ways to
solve this problem, and a workaround has
been presented.  Closing this out with
"Won't Fix" in 8.4.
kennykb Ticket [1118650fff]: 2 changes [History diff]2005-02-08 23:35:02
Log in (anonymous is fine) to add a comment.