Version 0 of Clock and Timing Granularity

Updated 2011-02-17 04:03:29 by Ro

How precise is the timing clock in tcl? When using the after command, an interesting thing happens when you start using small values, you don't necessarily get the callback until later. This can cause problems if you are doing animation, like I am right now.

Run on different WinXP SP2 computers:

Not so good.

  % set e [clock micro] ; after 5 {puts [expr [clock micro] - $e]}
  after#39
  16000

Now this is more like it!

  % set e [clock micro] ; after 5 {puts [expr [clock micro] - $e]}
  after#5914
  5055

Different machines will fail at different small values. I think this is because of the way the after command must be implemented on windows. See this page: http://www.geisswerks.com/ryan/FAQS/timing.html