Clock Display using After



I have written a simple ISO 8601 format clock display (source below).

I have noticed the time value will creep ahead of the system time by as
much as 30 seconds each day running. I do not understand why. I
believe [clock seconds] queries the system time and is evaluated each
time the after event is triggered. The fact that the displayed time
gets ahead of the system time is strange.

Any help would be much appreciated.

Chad


System:
Windows XP running tcl/tk 8.4.1 from cygwin.

Source:

variable date;

proc iso8601date { } {
global date;

set seconds [clock seconds];
set date [clock format ${seconds} -gmt 1 -format {%Y-%m-%dT%TZ}];

after 500 iso8601date;
};

iso8601date;

package require Tk;

wm protocol . WM_DELETE_WINDOW { exit };
wm title . "ISO8601 Date";

label .l -textvariable date -font {Arial 12 bold};
pack .l -padx 20;

wm resizable . 0 0;

bind .l <Double-Button-1> {
clipboard clear;
clipboard append [.l cget -text];
};

.


Quantcast