ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rpict.c
(Generate patch)

Comparing ray/src/rt/rpict.c (file contents):
Revision 2.30 by greg, Thu Oct 28 15:24:19 1993 UTC vs.
Revision 2.33 by greg, Tue Nov 23 09:56:31 1993 UTC

# Line 12 | Line 12 | static char SCCSid[] = "$SunId$ LBL";
12  
13   #include  "ray.h"
14  
15 + #include  <sys/types.h>
16 +
17   #ifndef NIX
18   #ifdef BSD
19   #include  <sys/time.h>
20   #include  <sys/resource.h>
21   #else
20 #include  <sys/types.h>
22   #include  <sys/times.h>
23 < #include  <limits.h>
23 > #include  <sys/utsname.h>
24 > #include  <unistd.h>
25   #endif
26   #endif
27  
28 + extern time_t   time();
29 +
30   #include  <signal.h>
31  
32   #include  "view.h"
# Line 83 | Line 87 | int  ralrm = 0;                                /* seconds between reports */
87  
88   double  pctdone = 0.0;                  /* percentage done */
89  
90 < long  tlastrept = 0L;                   /* time at last report */
90 > time_t  tlastrept = 0L;                 /* time at last report */
91  
92 < extern long  time();
89 < extern long  tstart;                    /* starting time */
92 > extern time_t  tstart;                  /* starting time */
93  
94   extern unsigned long  nrays;            /* number of rays traced */
95  
# Line 130 | Line 133 | int  code;
133   #ifndef NIX
134   report()                /* report progress */
135   {
133        char  hostname[128];
136          double  u, s;
137   #ifdef BSD
138 +        char  hostname[257];
139          struct rusage  rubuf;
140   #else
141          struct tms  tbuf;
142 +        struct utsname  nambuf;
143 +        double  period;
144 + #define hostname  nambuf.sysname
145   #endif
146  
147 <        tlastrept = time((long *)0);
147 >        tlastrept = time((time_t *)NULL);
148   #ifdef BSD
149          getrusage(RUSAGE_SELF, &rubuf);
150          u = rubuf.ru_utime.tv_sec + rubuf.ru_utime.tv_usec/1e6;
# Line 146 | Line 152 | report()               /* report progress */
152          getrusage(RUSAGE_CHILDREN, &rubuf);
153          u += rubuf.ru_utime.tv_sec + rubuf.ru_utime.tv_usec/1e6;
154          s += rubuf.ru_stime.tv_sec + rubuf.ru_stime.tv_usec/1e6;
155 +        gethostname(hostname, sizeof(hostname));
156   #else
157          times(&tbuf);
158 <        u = ( tbuf.tms_utime + tbuf.tms_cutime ) / CLK_TCK;
159 <        s = ( tbuf.tms_stime + tbuf.tms_cstime ) / CLK_TCK;
158 >        period = 1.0 / sysconf(_SC_CLK_TCK);
159 >        u = ( tbuf.tms_utime + tbuf.tms_cutime ) * period;
160 >        s = ( tbuf.tms_stime + tbuf.tms_cstime ) * period;
161 >        uname(&nambuf);
162   #endif
154        gethostname(hostname, sizeof(hostname));
163  
164          sprintf(errmsg,
165                  "%lu rays, %4.2f%% after %.3fu %.3fs %.3fr hours on %s\n",
166                          nrays, pctdone, u/3600., s/3600.,
167                          (tlastrept-tstart)/3600., hostname);
168          eputs(errmsg);
169 + #undef hostname
170   }
171   #else
172   report()                /* report progress */
173   {
174 <        tlastrept = time((long *)0);
174 >        tlastrept = time((time_t *)NULL);
175          sprintf(errmsg, "%lu rays, %4.2f%% after %5.4f hours\n",
176                          nrays, pctdone, (tlastrept-tstart)/3600.0);
177          eputs(errmsg);
# Line 422 | Line 431 | char  *zfile, *oldfile;
431                          goto writerr;
432                                                          /* record progress */
433                  pctdone = 100.0*(vres-1-ypos)/vres;
434 <                if (ralrm > 0 && time((long *)0) >= tlastrept+ralrm)
434 >                if (ralrm > 0 && time((time_t *)NULL) >= tlastrept+ralrm)
435                          report();
436   #ifndef  BSD
437                  else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines