NAME
====
  vg_wait_time() - wait a time until required loop-time has been reached


SYNOPSIS
========
  int vg_wait_time(int msec)


DESCRIPTION
===========
  Different events in your game (e.g. more or less enemies) need different
  time. So sometimes your game is running slowlier, sometimes faster, which
  is not desiderated.

  To keep your game-loop running in a constant time,
   - define a realistic time your game-loop could need, if it has a lot to do
   - call vg_wait_time() with this realistic time
  If your loop actually needed less time, the rest of the time is waited.
  msec is this realistic time in milliseconds and should be
  always the same.

  vg_wait_time() saves a timestamp of the actual call. When called again,
  it compares the saved timestamp with the actual timestamp and waits the
  time missing to msec.
  Therefore vg_wait_time() is useful only if called again and again, because
  the first call (or a call after a long time) realizes a great timestamp-
  difference and returns at once without waiting.

  Example:
    const int looptime=70;
    [...]     // initializing
    for (;;) {  // game loop
      [...]     // do your loop actions
      vg_wait_time(70);  // wait until loop took 70 milliseconds
    }


RETURN VALUE
============
  If it succeeds, it returns the waited (=slept) time in milliseconds.
  If an error occurs, it returns -1, giving out an error message to stderr.


SEE ALSO
========
  Index