Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-05-22
09:43 • Closed ticket [1e2c6ce4c8]: MS-Windows: after is not continuous, if Wall clock c... artifact: f6f8823ea8 user: oehhar
09:32 • Ticket [1e2c6ce4c8]: 3 changes artifact: 309bc67fc6 user: apnadkarni
2025-05-21
13:02
[1e2c6ce4], TIP 723: document interp limit to be dependent on monotonic clock on Windows platform leaf check-in: 8c56c95f93 user: oehhar tags: 1e2c6ce4-mswin-monotonic-clock
10:23 • Ticket [1e2c6ce4c8] MS-Windows: after is not continuous, if Wall clock changes</... artifact: a8e6d9d63d user: oehhar
2025-05-13
20:00 • Ticket [1e2c6ce4c8]: 3 changes artifact: 19e3b57be2 user: oehhar
19:58
[1e2c6ce4] Monotonic clock for MS-Windows. Extracted from branch [tkt3328635-posix-monotonic-clock] ... check-in: 8ea9c4081c user: oehhar tags: 1e2c6ce4-mswin-monotonic-clock
19:49 • New ticket [1e2c6ce4c8] MS-Windows: after is not continuous, if Wall clock chang... artifact: 7f54ef69aa user: oehhar

MS-Windows: after is not continuous, if Wall clock changes

Closed / Fixed1e2c6ce4c8a883c962b77df1d572383fce73ad1cCreated 2 years agoUpdated 195 days ago
Descriptionwiki2025-05-13 19:49:11
For me, it is a big improvement, if the after events would be independent on the wall-clock. I use devices not connected to the internet and the wall-clock is set manualy. This causes, that after events are delayed by the wall-clock offset, if set back, and fire sonner by the offset, if set foreward. In practice, the gui freezes, as its update depends on continuous after events.

For me, this is the top anoying bug of Tcl/Tk and work-arounds are very difficult. When I allow the user to change the wall-clock by an Administrator dialog, I fire 70 after events in a one minuite raster in the future, to hope, that at least, one fires after one minuite after the wall clock change.

There were huge objections to change this.

Ticket [3328635] handles this for the Unix case, but has a MS-Windows solution in its bugfix-branch tkt3328635-posix-monotonic-clock https://core.tcl-lang.org/tcl/timeline?r=tkt3328635-posix-monotonic-clock&c=2025-05-13+05%3A42%3A00. Thanks, Christian, for this work.

The purpose of this ticket is to extract the MS-Windows part of this ticket.

An issue of this ticket is TIP 233 https://core.tcl-lang.org/tips/doc/trunk/tip/233.md:

Christian has deactivated this TIP in his patch and calls it not functional and not documented. Andreas, the TIP author, is willing to look into this. To his words, the use-case of this TIP is not compatible to a monotonic clock. If this TIP should only influence the wall clock (e.g. the clock command), and not the after command, then this could be done.

I am not sure how to proceed. I only fear, that this may be lost. Due to that risk, all other great proposals and platforms are not included here.

Implementation branch is [1e2c6ce4-mswin-monotonic-clock] starting with checkin [8ea9c4081c].

Here is my test recipe:

proc pt sec10 {
    puts "sec10=$sec10, clock=[expr {[clock seconds]-$::now}]"
}
set now [clock seconds]
for {set sec 10} {$sec<=180} {incr sec 10} {after [expr {$sec*1000}] [list pt $sec]}
vwait forever

Then, I start cmd.exe as Administrator and type "time" and I advance the time by 10 minuites. Alternatively, you may hibernate the computer and wake-it up back,

The clock-output should have a jump, but the one minuite frequency of the output should remain.

Thanks for all, Harald

oehhar Ticket [1e2c6ce4c8]: 3 changes [History diff]2025-05-13 20:00:44
oehharwiki2025-05-21 10:23:47

Now in TIP 723: https://core.tcl-lang.org/tips/doc/trunk/tip/723.md

Thanks for all, Harald

apnadkarniplain2026-05-22 09:32:31
@oehhar, can this now be closed?
oehharwiki2026-05-22 09:43:46

Solved by TIP723. Thanks for all, Harald

Log in (anonymous is fine) to add a comment.