home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / mntlib32.zoo / clock.c < prev    next >
C/C++ Source or Header  |  1993-02-17  |  765b  |  36 lines

  1. /* _clock -- return process time used so far, in units of CLK_TCK ticks
  2.    per second (under TOS, 200 per second) */
  3. /* written by ERS */
  4.  
  5. #include <time.h>
  6. #include <osbind.h>
  7.  
  8. extern clock_t _starttime; /* in main.c */
  9.  
  10. static clock_t now;
  11.  
  12. /* this must execute in supervisor mode; it fetches the system variable
  13.  * containing the number of 200HZ ticks since the system was booted
  14.  */
  15.  
  16. static void getnow() { now = *((unsigned long *) 0x4baL); }
  17.  
  18. clock_t
  19. _clock()
  20. {
  21.     (void)Supexec(getnow);
  22.     return (now - _starttime);
  23. }
  24.  
  25. /* This next bit of nonsense is temporary...clock() should be fixed! */
  26.  
  27. #ifdef __GNUC__
  28. asm(".stabs \"_clock\",5,0,0,__clock"); /* dept of clean tricks */
  29. #else /* ! __GNUC__ */
  30. clock_t
  31. clock()
  32. {
  33.   return _clock();
  34. }
  35. #endif /* ! __GNUC__ */
  36.