Skip to content
Tcl Source Code View Ticket
Login

View Ticket

[clock scan] gets confused by [clock format]

Closed / Duplicate1929060fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2008-03-30 01:18:05
Run the following two commands in a fresh tclsh:

% clock format 0 -format "%D %H:%M:%S"
% clock scan "01/01/1970 00:00:00"\
   -format "%m/%d/%Y %H:%M:%S"

The following error is returned:

input string does not match supplied format
    while executing
"$scanner $string $base $timezone"
    (procedure "::tcl::clock::scan" line 82)
    invoked from within
"clock scan "01/01/1970 00:00:00"\
   -format "??/??/210 H:M:0x00000000""
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 clock\ scan\ \"01/01/1970\ 00:00:00\"\\\n\ \ \ -format\ \"??/??/210\ H:M:0x00000000\""

Now start another tclsh and run the following three commands:

% clock scan "01/01/1970 00:00:00"\
   -format "%m/%d/%Y %H:%M:%S"
% clock format 0 -format "%D %H:%M:%S"
% clock scan "01/01/1970 00:00:00"\
   -format "%m/%d/%Y %H:%M:%S"

No error is returned; instead, 21600 is returned, as expected.

It looks like running [clock format] before the first [clock scan] can potentially screw up the internal state of the [clock] command.

This problem was originally discovered by Peter Turner.  His email address is similar to Peter.Turner@com!forthc  .  He experienced it when using my timebox command, found at http://andy.junkdrome.org/devel/timebox/ .
dkf Ticket [1929060fff]: 1 change [History diff]2008-03-30 09:09:52
dkf Ticket [1929060fff]: 1 change [History diff]2008-03-30 09:09:53
kennykbplain2008-03-30 10:13:36
Logged In: YES 
user_id=99768
Originator: NO

Can you verify that you're actually running one of 
the 8.5.2 release candidates? Your symptoms appear to
duplicate [Bug 1902423], for which a fix went it on
2008-02-27.  I see the described behaviour in 8.5.0,
but cannot reproduce it in either 8.5.2rc3 or the HEAD.
kennykb Pending ticket [1929060fff]. [History diff]2008-03-30 10:13:37
pgturnerplain2008-03-30 20:39:15
Logged In: YES 
user_id=1042572
Originator: NO

Apparently not.  I, for one, am using ActiveTcl8.5.1.0.284069-win32-ix86-threaded.exe.  Behavior and patchlevel are same in WinTclTk-8.5.1.exe.

patchlevel returns 8.5.1

I certainly can wait for distributions to catch up.
andygothplain2008-03-31 01:14:39
Logged In: YES 
user_id=8653
Originator: YES

I just upgraded to today's CVS, and the problem went away.

My patchlevel before was 8.5.1b1 or similar.  I thought I was doing a better job of keeping up-to-date.  I guess not.
Log in (anonymous is fine) to add a comment.