projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dns: prefer monotonic clock for timeouts
[musl]
/
src
/
network
/
res_msend.c
diff --git
a/src/network/res_msend.c
b/src/network/res_msend.c
index
11c6aa0
..
fef7e3a
100644
(file)
--- a/
src/network/res_msend.c
+++ b/
src/network/res_msend.c
@@
-25,7
+25,8
@@
static void cleanup(void *p)
static unsigned long mtime()
{
struct timespec ts;
static unsigned long mtime()
{
struct timespec ts;
- clock_gettime(CLOCK_REALTIME, &ts);
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0 && errno == ENOSYS)
+ clock_gettime(CLOCK_REALTIME, &ts);
return (unsigned long)ts.tv_sec * 1000
+ ts.tv_nsec / 1000000;
}
return (unsigned long)ts.tv_sec * 1000
+ ts.tv_nsec / 1000000;
}