ARexx (40/65)

From:Dave Clarke
Date:23 May 2001 at 10:57:47
Subject:Re: Timer device

Once upon a time, 23-May-01 19:43:50, Neil Bothwick spoke thus about
'Re: [arexx] Timer device':

>ronphil said,

>> Could anybody recommend a library or anything else that operates a
>> timer.device that runs as a task without chewing up processor cycles
>> just checking and waiting for an event. The time functions in Arexx
>> have pretty limited use. What I am trying to do is set some times and
>> have a flag or other signal sent when that event comes up. I can do
>> this now but constantly looping and checking the time against a
>> varible really bogs down other things that are running.

>Use the delay() function from rexxsupport.library. It takes one
>argument, the delay in ticks.

>You can use time() to calculate how many seconds between now and when
>you want the event to occur, then multiply this by 50 or 60 and pass it
>to delay().

This might be useful:
---------------------8<--------------------
/* AT.rexx - A Simple AT command */
parse arg hh':'mm cmd .
if ~datatype(hh,'n') | ~datatype(mm,'n') | hh < 0 | hh > 23 | mm < 0 | mm > 59 then do
say 'Syntax: AT hh:mm command'
exit 1
end
else target = ((hh * 60) + mm) * 60
signal on Halt
do forever
now = time('s')
if target < now then
call delay((86400 - now + target) * 50)
else
call delay((target - now) * 50)
address command cmd
call delay(50)
end

Halt:
exit
---------------------8<--------------------

Use as:

rx AT.rexx 16:45 List

It'll see if it's before or after the time and call Delay as appropriate.

Dave



_--_|\ Dave Clarke | Four Wheel Drive: - Helps you get stuck |
/ \ | faster, harder, further from help.|
\_.--.*/ <-Melbourne | Powered by: A3000 '060/50+604/180 138MB |
v 4wddjc@goconnect.net| P-IV/Concierto/Pablo/Paloma |


Right! I run System V on my VIC-20!

ARexx mailing list - No flames, no overquoting, no crossposting.
Unsub: Blank mail to mailto:arexx-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/