mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-14 06:49:35 -04:00
detect CLOCK_MONOTONIC at runtime for evdns
svn:r896
This commit is contained in:
parent
707f67849a
commit
409236a77d
@ -114,6 +114,7 @@ Changes in current version:
|
|||||||
o Correct handling of trailing headers in chunked replies; from Scott Lamb.
|
o Correct handling of trailing headers in chunked replies; from Scott Lamb.
|
||||||
o Support multi-line HTTP headers; based on a patch from Moshe Litvin
|
o Support multi-line HTTP headers; based on a patch from Moshe Litvin
|
||||||
o Reject negative Content-Length headers; anonymous bug report
|
o Reject negative Content-Length headers; anonymous bug report
|
||||||
|
o Detect CLOCK_MONOTONIC at runtime for evdns; anonymous bug report
|
||||||
|
|
||||||
Changes in 1.4.0:
|
Changes in 1.4.0:
|
||||||
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
|
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
|
||||||
|
12
evdns.c
12
evdns.c
@ -1056,12 +1056,16 @@ default_transaction_id_fn(void)
|
|||||||
u16 trans_id;
|
u16 trans_id;
|
||||||
#ifdef DNS_USE_CPU_CLOCK_FOR_ID
|
#ifdef DNS_USE_CPU_CLOCK_FOR_ID
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
static int clkid = -1;
|
||||||
|
if (clkid == -1) {
|
||||||
|
clkid = CLOCK_REALTIME;
|
||||||
#ifdef CLOCK_MONOTONIC
|
#ifdef CLOCK_MONOTONIC
|
||||||
if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
|
if (clock_gettime(CLOCK_MONOTONIC, &ts) != -1)
|
||||||
#else
|
clkid = CLOCK_MONOTONIC;
|
||||||
if (clock_gettime(CLOCK_REALTIME, &ts) == -1)
|
|
||||||
#endif
|
#endif
|
||||||
event_err(1, "clock_gettime");
|
}
|
||||||
|
if (clock_gettime(clkid, &ts) == -1)
|
||||||
|
event_err(1, "clock_gettime");
|
||||||
trans_id = ts.tv_nsec & 0xffff;
|
trans_id = ts.tv_nsec & 0xffff;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user