am ea9800e9: Explain why clock(3) isn\'t broken.
* commit 'ea9800e98598c71fe76c4e2a0d0498b6bd490a83': Explain why clock(3) isn't broken.
This commit is contained in:
commit
22f5a61d95
@ -34,5 +34,8 @@
|
||||
clock_t clock() {
|
||||
tms t;
|
||||
times(&t);
|
||||
// Although times(2) and clock(3) both use the type clock_t, the units are
|
||||
// different. For times(2) it's pure clock ticks, but for clock(3) the unit
|
||||
// is CLOCKS_PER_SEC, so we need to scale appropriately.
|
||||
return (t.tms_utime + t.tms_stime) * (CLOCKS_PER_SEC / sysconf(_SC_CLK_TCK));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user