#3063 Problem with function clock

final: 8.3.5
closed-wont-fix
Kevin B KENNY
5
2005-02-08
2005-02-08
yandres
No

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"

Discussion

  • Kevin B KENNY
    Kevin B KENNY
    2005-02-08

    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.

     
  • Kevin B KENNY
    Kevin B KENNY
    2005-02-08

    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.

     
  • Kevin B KENNY
    Kevin B KENNY
    2005-02-08

    • status: open --> closed-wont-fix