here is the CLOCKFACE script...coded in 3 MINUTES...17 LINES of CODE

Geoff Canyon geoff at runrev.com
Mon May 30 12:22:43 EDT 2005


I had just finished swapping out my clunky send...in loop code for  
something similar to yours when I checked mail and saw yours. I took  
two steps:

put the long seconds into t
send in (something based on t - trunc(t)

Your method of the long seconds mod 1 is of course much better. But  
you don't have to convert to ticks. Sending in a fraction of a second  
works fine and reads better imho.

So here's what I have up now. This generally hits within a thousandth  
of a second:

on openCard
   setTime
end openCard

on setTime
   put word 1 of the long time into T
   put T && the long seconds into fld "time"
   set the itemDelimiter to ":"
   set the startangle of grc "hour" to 90 - (30 * item 1 of T) -  
(item 2 of T) / 2
   set the startangle of grc "minute" to 90 - (6 * item 2 of T) -  
(item 3 of T) / 10
   set the startangle of grc "second" to 90 - (6 * item 3 of T)
   send "setTime" to me in (1 - (the long seconds mod 1)) seconds
end setTime

As before, the stack is available by executing this in the message box:

go stack url "http://www.inspiredlogic.com/rev/clock.rev"


On May 30, 2005, at 9:01 AM, Dennis Brown wrote:

> I love this clock example.  Just so simple.  You guys are great!  I  
> could not resist seeing how the thinking was progressing and took  
> it to the next step.  Fewer lines, more accuracy (I have often  
> noted that the simplest most elegant solutions take the most time  
> to create and the least time to understand).  As Ben suggested,  
> this clock should be a standard example for new users to look at.   
> I will also add it to my revOnline user area (see3d) as soon as  
> today's connect problem is fixed.
>



More information about the use-livecode mailing list