Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f2377f9eb70433a023052c8515ae6af78d66d653937858bc670d8614e13acb07
Ticket: 1464890fffffffffffffffffffffffffffffffff
after command hangs when system time changes
User & Date: anonymous on 2026-08-12 16:17:15
Changes

  1. assignee changed to: "aku"
  2. closer changed to: "nobody"
  3. comment changed to:
    Hello,
    
    I wish to reopen bug #432038, and its duplicate bug
    #1052859:
    
    Changing the system clock hangs all Tcl events handlers
    that are scheduled with the after command.
    This makes it impossible to have reliable periodic
    handlers written in pure Tcl. (They may die
    unexpectedly anytime somebody runs the date/time command)
    
    I've just been badly hurt by this very problem on a
    large cluster we manage: We had system monitoring
    scripts written in Tcl that kept dying mysteriously on
    some of the nodes. And the illness was spreading with
    time...
    
    Contrary to what was written in a comment of bug
    #432038, using NTP does not prevent the problem:
    We saw the problem on machines with harware clocks
    slowly drifting. After each reboot, NTP takes some time
    for resynchronizing the system time... hanging all our
    Tcl scripts timers when it eventually does.
    
    Also I completely disagree with the closing comment in
    bug #1052859 about the lack of monotonically increasing
    timers in both Unix and Windows.
    The Unix sleep command, used in tons of shell scripts,
    is completely immune to such system date/time changes.
    This is easy to verify. Let's use in Tcl's after
    command the same timing function that Unix' sleep does.
    Likewise, Windows' waitable timers are immune too. I
    just verified it with the sample code for
    CreateWaitableTimer in MSDN library.
    
    Jean-François
    
  4. icomment:
    In 2026 this is still super-problematic issue.
    
    Can we please agree on some kind of solution? Once the solution is ready, implementation should be easy. But there might be some need to extend the portable layer to expose the underlying OS API...
    
  5. login: "anonymous"
  6. mimetype: "text/plain"
  7. severity changed to: "Minor"