That is a good point. I tested it out, and the useless "set angle" results in about 70ms of wasted time every second (7% CPU). I am surprised it is so high. Doing the test and skipping it is a thousand times faster. I fixed up the script as my own exercise for the student. You can see the time lag slightly when the computer is busy with something else, like loading a web page.

Note: the angle calculations had to be changed to match what the angle returned for these graphics. The clock is in my user space (see3d). It takes a licking, but keeps on ticking...

on openCard
  setTime
end openCard

on setTime
  set the itemDelimiter to ":"
  put word 1 of the long time into T --8:13:15
  put T & char 2 to 5 of (the long seconds mod 1) into fld "Time"
  get 360+90-(30 * item 1 of T) - trunc((item 2 of T) / 2)
if (the angle of grc "Hour") <> it then set the angle of grc "Hour" to it
  get 360+90-(6 * item 2 of T) - trunc((item 3 of T) / 10)
if (the angle of grc "Minute") <> it then set the angle of grc "Minute" to it
  set the angle of grc "Second" to 360+90-(6 * item 3 of T)
  send "setTime" to me in 1-(the long seconds mod 1) seconds
end setTime


Dennis

On May 30, 2005, at 2:21 PM, Geoff Canyon wrote:

On May 30, 2005, at 10:04 AM, Dennis Brown wrote:


Nice! I learn something every minute on this list --four heads are better than one. I do believe that the clock is down to its essence now. Every line does something essential, except displaying the "Time" field to check its accuracy. I put the latest version in my user space also (see3d).


re: down to its essence -- obviously for this demo it doesn't matter, but in practice, I would want to put in code to only change the minute and hour hands when they actually need it, rather than setting them to the same startAngle (except when they actually move) each second. I haven't timed this to see whether it's actually a concern.

And multiple heads are definitely better than one. That's why I plan to grow additional heads as soon as possible. ;-)
_______________________________________________
use-revolution mailing list
[email protected]
http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[email protected]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to