home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / Effect library / Demo ƒ / MSG Shell ƒ / msg timing.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-12  |  1.3 KB  |  49 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        msg timing.c
  4.  
  5. Purpose:    This module handles timing loops, based on the TickCount,
  6.             so that time-sensitive procedures operate at the same
  7.             speed on all Macintoshes.
  8.  
  9.  
  10. MSG Demo -- graphic effects demonstration program
  11. Copyright (C) 1992-4 Mark Pilgrim & Dave Blumenthal
  12.  
  13. This program is free software; you can redistribute it and/or modify
  14. it under the terms of the GNU General Public License as published by
  15. the Free Software Foundation; either version 2 of the License, or
  16. (at your option) any later version.
  17.  
  18. This program is distributed in the hope that it will be useful,
  19. but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. GNU General Public License for more details.
  22.  
  23. You should have received a copy of the GNU General Public License
  24. along with this program in a file named "GNU General Public License".
  25. If not, write to the Free Software Foundation, 675 Mass Ave,
  26. Cambridge, MA 02139, USA.
  27.  
  28. \**********************************************************************/
  29.  
  30. #include "msg timing.h"
  31.  
  32. long        oldTicks;
  33.  
  34. pascal void StartTiming(void)
  35. {
  36.     oldTicks=TickCount();
  37. }
  38.  
  39. pascal void TimeCorrection(int tickCount)
  40. {
  41.     long        newTicks;
  42.     
  43.     newTicks=TickCount();
  44.     while (newTicks-oldTicks<tickCount)
  45.     {
  46.         Delay(1L, &newTicks);
  47.     }
  48. }
  49.