[comp.unix.wizards] Timed input

frank@rsoft.UUCP (Frank I. Reiter) (01/09/89)

In article <8800006@gistdev> flint@gistdev.UUCP writes:
>
>(For example, if I want my user
>to type as many keys as they want to within 10 seconds, and then evaluate
>that amount of input, I'm stuck: I have to change the timelimit with each
>successive keypress to be "10 - time_used_so_far", and the only way to do
>so is with an incredibly slow ioctl() call on each keypress.

Set an alarm for 10 seconds and then read the characters using read() or
fgetc() or whatever you like until the alarm goes off.

flint@gistdev.UUCP (01/10/89)

Give me multiple alarms at once and I'll think about that: that approach
won't work for me quite often because the alarm is in use for something
else.  (Ex: the alarm is in use to check-point my shared memory to disk
every so often.)  A second problem with alarm is that with timing
granularity of only 1 second it doesn't give me very good accuracy or
control, and I'm stuck with a minimum delay of 1 second.  (I've had
numerous cases where I wanted the time limit to be .1 to .4 seconds and was
forced to choose between 0 and 1.  I've also had customers beat me over
the head because they didn't think that 0.1 seconds granularity was
good enough for them.)  (Of course, they wanted UNIX, they just want
real-time response besides.) 

Flint Pellett, Global Information Systems Technology, Inc.
1800 Woodfield Drive, Savoy, IL  61874     (217) 352-1165
INTERNET: flint%gistdev@uxc.cso.uiuc.edu
UUCP:     {uunet,pur-ee,convex}!uiucuxc!gistdev!flint