repo.or.cz
/
musl.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
iconv: add euro symbol to GBK as single byte 0x80
[musl.git]
/
src
/
time
/
clock.c
blob
6724012b92ef69b8dfa19e087b940aaf6a141e10
1
#include <time.h>
2
#include <limits.h>
3
4
clock_t
clock
()
5
{
6
struct
timespec ts
;
7
8
if
(
__clock_gettime
(
CLOCK_PROCESS_CPUTIME_ID
, &
ts
))
9
return
-
1
;
10
11
if
(
ts
.
tv_sec
>
LONG_MAX
/
1000000
12
||
ts
.
tv_nsec
/
1000
>
LONG_MAX
-
1000000
*
ts
.
tv_sec
)
13
return
-
1
;
14
15
return
ts
.
tv_sec
*
1000000
+
ts
.
tv_nsec
/
1000
;
16
}