Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Clock scan "1 day" is wrong

Closed / Invalid1545823fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-08-24 09:17:22
Hi guys,

Playing with the clock command using 8.5a4 I've found a
new bug.

Here is the example:

(Bin) 7 % set timein [clock seconds]
1156410538
(Bin) 8 % set timeout [clock scan "1 hour" -base $timein]
1156414138
(Bin) 9 % set timeout [clock scan "60 minutes" -base
$timein]
1156414138
(Bin) 10 % set timeout [clock scan "24 hour" -base $timein]
1156496938
(Bin) 11 % set timeout [clock scan "1440 minutes" -base
$timein]
1156496938
(Bin) 12 % set timeout [clock scan "1 day" -base $timein]
1156456800

As you can see, the answers for "1 hour" and "60
minutes" are the same, and the answers for "24 hour"
and "1440 minutes" are also ok, but the "1 day" is
different. Why?
And not, I'm not crossing any "daylight savings time
boundary"

Cheers,
wildcard_25plain2006-08-24 17:04:07
Logged In: YES 
user_id=596509

It works as documented.

"If a date or day is specified, and no absolute or 
relative time is given, midnight is used."

(Tcl85) 1 % clock scan "1 day"
1156428000
(Tcl85) 2 % clock scan "24 hours"
1156499468
(Tcl85) 3 % clock add [clock seconds] 24 hours
1156499480
(Tcl85) 4 % clock add [clock seconds] 1 day
1156499494
ctasadaplain2006-08-24 17:21:59
Logged In: YES 
user_id=340696

Probably I'm misunderstanding the documentation but how can
I  specify an absolute or relative time in [clock scan "1
day" -base $timein]?

Anyway I missed this line :(
wildcard_25plain2006-08-24 17:46:21
Logged In: YES 
user_id=596509

"1 hour" is a relative time.
"08:00 PM" is absolute.

As [clock scan "1 day"] has no hours, minutes or seconds 
specified, it uses midnight as the hour of day that is 1 
day from now.

If I wanted to add "x days" to the current time then I 
would use [clock add].
ctasadaplain2006-08-24 17:57:27
Logged In: YES 
user_id=340696

Ooook, I completely misunderstood the documentation.

Thanks a lot. I close the bug and mark it as invalid :)
Log in (anonymous is fine) to add a comment.