home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Raytrace & Morphing / SOS-RAYTRACE.ISO / programm / source / rayce27s / linux.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-02  |  1.5 KB  |  71 lines

  1.  
  2. /*
  3.  * linux.c -- device dependent stuff for Linux GCC
  4.  * 
  5.  * (c) 1993, 1994 by Han Wen Nienhuys <hanwen@stack.urc.tue.nl>
  6.  * 
  7.  * This program is free software; you can redistribute it and/or modify it
  8.  * under the terms of the GNU General Public License as published by the
  9.  * Free Software Foundation;
  10.  * 
  11.  * This program is distributed in the hope that it will be useful, but
  12.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * General Public License for more details.
  15.  * 
  16.  * You should have received a copy of the GNU General Public License along
  17.  * with this program; if not, write to the Free Software Foundation, Inc.,
  18.  * 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <time.h>
  24. #include <signal.h>
  25.  
  26. #include "ray.h"
  27. #include "proto.h"
  28. #include "extern.h"
  29.  
  30. /* check for an abort condition, such as keypress */
  31. PUBLIC void
  32. check_abort(void)
  33. {
  34.     return;
  35. }
  36.  
  37. PRIVATE clock_t ts;
  38.  
  39. /* start the timer. Using clock ticks isn't exactly elegant, but it works */
  40. PUBLIC void
  41. timer_start(void)
  42. {
  43.     ts = clock();
  44. }
  45.  
  46. /*
  47.  * stop the timer, and return the number of seconds from last call to
  48.  * timer_start() in 10ths of secs.
  49.  */
  50. PUBLIC long
  51. timer_stop(void)
  52. {
  53.     clock_t         st;
  54.  
  55.     st = clock();
  56.     return (long) ((10 * (st - ts)) / CLOCKS_PER_SEC);
  57. }
  58.  
  59. PUBLIC void
  60. init_machine(void)
  61. {
  62.     /* ignore floating point errors */
  63.     signal(SIGFPE, SIG_IGN);
  64.     signal(SIGINT, abort_trace);
  65.  
  66.     if (silent_mode)
  67.     signal(SIGHUP, SIG_IGN);
  68.  
  69.     return;
  70. }
  71.