projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
math: remove *_WORD64 macros from libm.h
[musl]
/
src
/
time
/
timer_gettime.c
diff --git
a/src/time/timer_gettime.c
b/src/time/timer_gettime.c
index
3d3156a
..
1d90207
100644
(file)
--- a/
src/time/timer_gettime.c
+++ b/
src/time/timer_gettime.c
@@
-1,7
+1,12
@@
#include <time.h>
#include <time.h>
+#include <limits.h>
#include "pthread_impl.h"
int timer_gettime(timer_t t, struct itimerspec *val)
{
#include "pthread_impl.h"
int timer_gettime(timer_t t, struct itimerspec *val)
{
- return syscall(SYS_timer_gettime, t->timerid, val);
+ if ((intptr_t)t < 0) {
+ pthread_t td = (void *)((uintptr_t)t << 1);
+ t = (void *)(uintptr_t)(td->timer_id & INT_MAX);
+ }
+ return syscall(SYS_timer_gettime, (long)t, val);
}
}