Framerate question (using standard refresh rates)

I want a way to ensure a semi-consistant frame-rate of my game across
machines of differing speeds. So, I lifted the following snippet (and
gave it it’s own function) from SL’s “aliens” code.

void WaitFrame(void)
{
static Uint32 next_tick = 0;
Uint32 this_tick;

    /* Wait for the next frame */
    this_tick = SDL_GetTicks();
    if ( this_tick < next_tick ) {
            SDL_Delay(next_tick-this_tick);
    }
    next_tick = this_tick + (1000/FRAMES_PER_SEC);

}

Not completely understanding this, and not having any other test platforms
significantly faster than my machine, I was just wondering if this was a
valid way to ensure constant frame-rate… or if I had just
missinterpreted the original code and it’s useless as I’m using it.

Or, I’m always open to other suggestions… :wink:

Thx in advance.–
Sam Hart http://www.physics.arizona.edu/~hart/
Web Page Highlights: Video Game History, Black Hole Simulation, & more.
OTHER WEB SITES MAINTAINED BY SAM HART
http://www.geekcomix.com/ - Geekcomix, the Daily Geek Comic Strip Site
http://www.physics.arizona.edu/~hart/gw/ - Ghostworks (Alt./Linux Computing)