Creating exact time delays 
Author Message
 Creating exact time delays

It's been about 13-15 years since I learned BASIC, though I surprisingly
remember much of it.  The only thing I have to get used to is not using
line numbers in QBASIC.

The question I have is this:  How do I create and exact time delay.  In
other words, perform a function, wait an exact amount of time (preferably
including fractions of a second), and then perform another function?  I
understand the TIMER can be used to get the exact time (in seconds only)
from midnight, but it apparently can't be used as a variable.  Plus it
would seem that there should be an easy way to measure relative time using
the PC's clock.  Any suggestions?

--
    ("`-''-/").___..--''"`-._        
     `6_ 6  )   `-.  (     ).`-.__.`)  Chad English

   _..`--'_..-_/  /--'_.' ,'       http://www.*-*-*.com/ ~cenglish
  (il).-''  (li).'  ((!.-'



Mon, 07 Dec 1998 03:00:00 GMT  
 Creating exact time delays

CE>The question I have is this:  How do I create and exact time delay.  In

Here is something I use, not the MOST accurate but accurate enough for
most purposes:

SUB Delay (Secs)
T = TIMER
WHILE (TIMER - T) < Secs
IF TIMER < T THEN T = T - 86400
WEND
END SUB



Wed, 09 Dec 1998 03:00:00 GMT  
 Creating exact time delays

Quote:

>CE>The question I have is this:  How do I create and exact time delay.  In
>Here is something I use, not the MOST accurate but accurate enough for
>most purposes:
>SUB Delay (Secs)
>T = TIMER
>WHILE (TIMER - T) < Secs
>IF TIMER < T THEN T = T - 86400
>WEND
>END SUB

Just a note: T and Secs (from above) have to be SINGLE or DOUBLE and
can't be INTEGER or LONG. I use the same routine and often use
DEFINT A-Z, which caused a little bit of odd behavior until I caught
on.....

Regards;
runester



Thu, 10 Dec 1998 03:00:00 GMT  
 Creating exact time delays

: It's been about 13-15 years since I learned BASIC, though I surprisingly
: remember much of it.  The only thing I have to get used to is not using
: line numbers in QBASIC.

: The question I have is this:  How do I create and exact time delay.  In
: other words, perform a function, wait an exact amount of time (preferably
: including fractions of a second), and then perform another function?  I
: understand the TIMER can be used to get the exact time (in seconds only)
: from midnight, but it apparently can't be used as a variable.  Plus it
: would seem that there should be an easy way to measure relative time using
: the PC's clock.  Any suggestions?

SLEEP will do exact seconds. I don't know how you'd do fractions of a
second. Suggestions anyone?

Wayne

--
                        Wayne Borean - AKA The Mad Hatter

I'll expand your universe....



Sat, 12 Dec 1998 03:00:00 GMT  
 Creating exact time delays

Quote:


>: It's been about 13-15 years since I learned BASIC, though I surprisingly
>: remember much of it.  The only thing I have to get used to is not using
>: line numbers in QBASIC.
>: The question I have is this:  How do I create and exact time delay.  In
>: other words, perform a function, wait an exact amount of time (preferably
>: including fractions of a second), and then perform another function?  I
>: understand the TIMER can be used to get the exact time (in seconds only)
>: from midnight, but it apparently can't be used as a variable.  Plus it
>: would seem that there should be an easy way to measure relative time using
>: the PC's clock.  Any suggestions?
>SLEEP will do exact seconds. I don't know how you'd do fractions of a
>second. Suggestions anyone?
>Wayne

now=timer
let x = the time delay

while timer<now+x
wend

the timer is updated every 18ms or so, so this would be one way
of doing it

You have to include a bit more code to handle midnight, but it seems to work
for me.

Shane



Sat, 12 Dec 1998 03:00:00 GMT  
 Creating exact time delays

Quote:


> : It's been about 13-15 years since I learned BASIC, though I surprisingly
> : remember much of it.  The only thing I have to get used to is not using
> : line numbers in QBASIC.

> : The question I have is this:  How do I create and exact time delay.  In
> : other words, perform a function, wait an exact amount of time (preferably
> : including fractions of a second), and then perform another function?  I
> : understand the TIMER can be used to get the exact time (in seconds only)
> : from midnight, but it apparently can't be used as a variable.  Plus it
> : would seem that there should be an easy way to measure relative time using
> : the PC's clock.  Any suggestions?

> SLEEP will do exact seconds. I don't know how you'd do fractions of a
> second. Suggestions anyone?

18.2 timer:

DIM T AS SINGLE
T = TIMER
WHILE TIMER < T + 0.1: WEND

vsync (approx 1/60th of a second):

WAIT &H3DA, 8
WAIT &H3DA, 8, 8

Quote:

> Wayne

> --
>                         Wayne Borean - AKA The Mad Hatter

> I'll expand your universe....

--
______________________________

Steven Sensarn

______________________________



Sat, 12 Dec 1998 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Sending a delayed email and have the time sent at the delayed time

2. Time delays and usual times

3. getting the exact time in VB 3.0

4. getting exact time in vb3.0

5. How to stop exact times in visual basic

6. Time Delays

7. Time Delay, close current form, open new form

8. Time Delay within procedure

9. How to give Time delay in VBA

10. Micro-Second time delays...

11. Timed Delay

12. Timed DELAY

 

 
Powered by phpBB® Forum Software