Timing Functions Dependent on the System Speed

The fg_waitfor() function described in the previous section is independent of the system's processor speed. This means the actual length of its delay is the same on any system. Another function, fg_stall(), is similar to fg_waitfor(), but its delay is proportional to the processor speed. Like fg_waitfor(), fg_stall() has a single integer parameter that specifies the length of the delay. However, instead of being expressed in clock ticks, fg_stall() measures the delay in delay units.

The fg_measure() function determines the number of delay units per clock tick for the processor being used. It has no parameters and returns the number of delay units per clock tick as its function value. Once we determine this value, we can use fg_stall() to delay a program's execution in real time. This provides a much more refined delay than the clock tick unit used by fg_waitfor().

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.