home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / QBAS / WNDTOOL5.ZIP / WAIT.SUB < prev    next >
Text File  |  1989-04-26  |  3KB  |  60 lines

  1. '
  2. '$PAGE
  3. '
  4. '******************************************************************************
  5. '                    Function :                                               *
  6. '                                                                             *
  7. ' Purpose:                                                                    *
  8. '                                                                             *
  9. '                                                                             *
  10. ' Results:                                                                    *
  11. '                                                                             *
  12. ' Usage  :                                                                    *
  13. '                                                                             *
  14. '                                                                             *
  15. ' Date Written : 01/01/89 - Date Tested: 01/01/89 - Author: James P Morgan    *
  16. ' Date Modified:          -            :          -       :                   *
  17. '-----------------------------------------------------------------------------*
  18. ' NOTE:                                                                       *
  19. '******************************************************************************
  20. '                                                                             *
  21. '     SUB PROGRAM NAME          (PARAMETERS)                 STATIC/RECURSIVE *
  22. '-----------------------------------------------------------------------------*
  23. '                                                                             *
  24. '============================================================================
  25. '
  26. '============================================================================
  27. '
  28. SUB    WAITTIME(WTIME!)                                                STATIC
  29. '
  30. 'Changed "WTIME%" to "WTIME!" to allow fractions of seconds to be passed
  31. 'as documented in the manual (JP -2/4/88)
  32.  
  33.        DEFINT A-Z                           'make all short intergers by default
  34.  
  35.        IF WTIME!<=0.0! THEN                 'valid time interval (not negative)?
  36.           WTIME!=1.0!                       'NO, so default to 1 second
  37.        ELSEIF WTIME!>86399! THEN            'more than the total seconds in a day?
  38.            WTIME!=1.0!                      'default to 1 second
  39.        END IF
  40.  
  41.        OLDTIME!=TIMER
  42.        NEWTIME!=OLDTIME!+WTIME!
  43.  
  44. WAIT.T.LOOP:
  45.        CURTIME!=TIMER
  46.        IF CURTIME!<OLDTIME! THEN            'in case of midnite rollover
  47.           CURTIME!=CURTIME!+86400!
  48.        END IF
  49.  
  50.        IF CURTIME! >= NEWTIME!  THEN        'has the wait time elapsed?
  51.            EXIT SUB                         'yes, return to caller
  52.        END IF
  53.  
  54.        IF INKEY$<>CHR$(27) THEN             'allow ESC key to break out of timer
  55.            GOTO WAIT.T.LOOP
  56.        END IF
  57.  
  58.        EXIT SUB                             'ESC pressed, return to caller
  59. END SUB
  60.