Revision 5f3adef4 monl/measure_dispatcher.cpp
monl/measure_dispatcher.cpp | ||
---|---|---|
24 | 24 |
#include "grapes_log.h" |
25 | 25 |
|
26 | 26 |
|
27 |
#ifndef WIN32 |
|
28 | 27 |
#include <arpa/inet.h> |
29 |
#else |
|
30 |
#include <winsock2.h> |
|
31 |
#endif |
|
32 | 28 |
#include <string.h> |
33 | 29 |
#include <sstream> |
34 | 30 |
#include <stdint.h> |
35 | 31 |
#include <sys/time.h> |
36 | 32 |
|
37 |
#include <cmath> |
|
38 |
|
|
39 | 33 |
//TODO: possible improvements: |
40 | 34 |
// - make buffer a ptr and don't make an explicit copy |
41 | 35 |
// - implement a better hash and compare for SocketId |
... | ... | |
920 | 914 |
mph->initial_ttl = (uint32_t)r_rem[R_INITIAL_TTL]; |
921 | 915 |
mph->ts_sec = htonl((uint32_t)floor(r_rem[R_SEND_TIME])); |
922 | 916 |
mph->ts_usec = htonl((uint32_t)((r_rem[R_SEND_TIME] - floor(r_rem[R_SEND_TIME])) * 1000000.0)); |
923 |
if(!std::isnan(r_rem[R_REPLY_TIME])) {
|
|
917 |
if(!isnan(r_rem[R_REPLY_TIME])) { |
|
924 | 918 |
mph->ans_ts_sec = htonl((uint32_t)floor(r_rem[R_REPLY_TIME])); |
925 | 919 |
mph->ans_ts_usec = htonl((uint32_t)((r_rem[R_REPLY_TIME] - floor(r_rem[R_REPLY_TIME])) * 1000000.0)); |
926 | 920 |
} else { |
... | ... | |
992 | 986 |
mdh->seq_num = htonl((uint32_t)r_rem[R_SEQNUM]); |
993 | 987 |
mdh->ts_sec = htonl((uint32_t)floor(r_rem[R_SEND_TIME])); |
994 | 988 |
mdh->ts_usec = htonl((uint32_t)((r_rem[R_SEND_TIME] - floor(r_rem[R_SEND_TIME])) * 1000000.0)); |
995 |
if(!std::isnan(r_rem[R_REPLY_TIME])) {
|
|
989 |
if(!isnan(r_rem[R_REPLY_TIME])) { |
|
996 | 990 |
mdh->ans_ts_sec = htonl((uint32_t)floor(r_rem[R_REPLY_TIME])); |
997 | 991 |
mdh->ans_ts_usec = htonl((uint32_t)((r_rem[R_REPLY_TIME] - floor(r_rem[R_REPLY_TIME])) * 1000000.0)); |
998 | 992 |
} else { |
Also available in: Unified diff