projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix sigsetjmp on arm (needs asm)
[musl]
/
src
/
time
/
clock.c
diff --git
a/src/time/clock.c
b/src/time/clock.c
index
2feddb3
..
d32cd09
100644
(file)
--- a/
src/time/clock.c
+++ b/
src/time/clock.c
@@
-1,9
+1,15
@@
#include <time.h>
#include <sys/times.h>
#include <time.h>
#include <sys/times.h>
+#include "syscall.h"
+
+int __clock_gettime(clockid_t, struct timespec *);
-/* this function assumes 100 hz linux and corrects for it */
clock_t clock()
{
clock_t clock()
{
+ struct timespec ts;
struct tms tms;
struct tms tms;
- return (unsigned long)times(&tms)*10000;
+ if (!__clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts))
+ return ts.tv_sec*1000000 + ts.tv_nsec/1000;
+ __syscall(SYS_times, &tms);
+ return (tms.tms_utime + tms.tms_stime)*100;
}
}