---system time call command
From: Bill Zhao (bzhaoa_at_tom.com)
Date: 12/25/03
- Next message: Googie: "how it can be?"
- Previous message: yahalom: "Re: Using Doxygen with Tcl/IncrTcl?"
- Next in thread: Gerald Lester: "Re: ---system time call command"
- Reply: Gerald Lester: "Re: ---system time call command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 25 Dec 2003 22:41:02 +0800
Dear All,
See below. it the demo file "timer" in the package tk-8.3.3-67
I did test it in windows and linux in my pc. and found that timer is
slow than system timer.
I want to improve it and get it use system time call in place of loop
counting which cause dida loss.
Sombody know what the system is ?
Bill Zhao
#!/bin/sh
# the next line restarts using wish \
exec wish8.3 "$0" "$@"
# timer --
# This script generates a counter with start and stop buttons.
#
# RCS: @(#) $Id: timer,v 1.2 1998/09/14 18:23:30 stanton Exp $
label .counter -text 0.00 -relief raised -width 10
button .start -text Start -command {
if $stopped {
set stopped 0
tick
}
}
button .stop -text Stop -command {set stopped 1}
pack .counter -side bottom -fill both
pack .start -side left -fill both -expand yes
pack .stop -side right -fill both -expand yes
set seconds 0
set hundredths 0
set stopped 1
proc tick {} {
global seconds hundredths stopped
if $stopped return
after 50 tick
set hundredths [expr $hundredths+5]
if {$hundredths >= 100} {
set hundredths 0
set seconds [expr $seconds+1]
}
.counter config -text [format "%d.%02d" $seconds $hundredths]
}
bind . <Control-c> {destroy .}
bind . <Control-q> {destroy .}
focus .
- Next message: Googie: "how it can be?"
- Previous message: yahalom: "Re: Using Doxygen with Tcl/IncrTcl?"
- Next in thread: Gerald Lester: "Re: ---system time call command"
- Reply: Gerald Lester: "Re: ---system time call command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]