Losing track of time
Robert Brenstein
rjb at rz.uni-potsdam.de
Mon Aug 11 19:14:00 EDT 2003
>On Monday, August 11, 2003, at 04:45 PM, Robert Brenstein wrote:
>
>>>On Monday, August 11, 2003, at 02:04 PM, Robert Brenstein wrote:
>>>
>>>>convert it to dateitems
>>>>add 1 to item 5 of it # up hour to next
>>>>if item 5 of it is 24 then # account for crossing midnight
>>>> put zero into item 5 of it
>>>> add 1 to item 4 of it
>>>> ## similar checks for month and year overflow here
>>>>end if
>>>>put zero into item 6 of it # zero out minutes
>>>>convert it to seconds
>>>
>>>get (round(it/3600) + 1)*3600
>>>
>>>Would this work?
>>>
>>>Dar Scott
>>>
>>
>>Nop. 'It' contains dateitems (yyyy,mm,dd,hh,mm,ss,w) not seconds at
>>this point.
>
>I was obtuse. I meant replace all of above lines (an it in seconds
>to it in seconds transformation) to the single line.
>
>Dar Scott
>
Hmm, you mean to have only
on fullhourchime
play sound # first play
get seconds()
get (round(it/3600) + 1)*3600
send fullhourchime to me in (it-seconds())
end fullhourchime
This would work if your replacement line produced the next full hour
in seconds. But I do not see how it does it -- it simply adds 1 hr to
the current seconds (and it is simpler to just add 3600 as the
original poster had it). The problem for repeated send's is that if
any process causes a delay as we keep calling ourselves, we will keep
drifting away more and more from proper time.
Of course, for chiming on the hour, it is an exercise in futility
since it may be simpler to use the system clock :)
Robert
More information about the use-livecode
mailing list