Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need a timeout script for no data entered into the terminal

Status
Not open for further replies.

sonic86

IS-IT--Management
Mar 22, 2002
6
US
This is what i have so far, but is there a system time variable as a long. I am new to aspect so any suggestions would be appreciated.

proc main
long curtime, lastinputtime
integer thischar

timeval lastinputtime
while (1) ;don't want to exit until there is nothing else entered into the term.
timeval curtime
termreadc thischar
if thischar != 0
timeval lastinputtime
endif
if curtime - lastinputime > 1200
exitwhile
endif
endwhile
termmsg "Disconnected after 20 minutes of idle time."
break
 
You can use the $LTIME system variable to get the number of seconds since midnight on 1/1/70. You can check the difference between the initial value of $LTIME stored in lastinputtime and the current value of $LTIME.

Another option you might want to look into is the use of the when quiet or when elapsed commands. One of these commands may fit your particular need a little better.
 
Thanks Knob!!
The when quiet command searches the recieve data line i need the transfer data line. I can't find anything on the when elapsed command in the help files. What is the def for that command. The $LTIME was exactly what i was looking for just seeing if there is an easier way to do it.
 
To find out more information about the when elapsed command, look under the discussion of the when command (when elapsed is just one form of the when command). However, after thinking it over a little more, I think your original strategy of checking the time might work better in your particular situation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top