12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #include <time.h>
- #include <unistd.h>
- #include <sys/times.h>
- clock_t
- clock (void)
- {
- struct tms buf;
- long clk_tck = CLK_TCK;
-
- times (&buf);
- return
- (clk_tck <= CLOCKS_PER_SEC) ?
- ((unsigned long) buf.tms_utime + buf.tms_stime) * (CLOCKS_PER_SEC / clk_tck) :
- ((unsigned long) buf.tms_utime + buf.tms_stime) / (clk_tck / CLOCKS_PER_SEC);
- }
|