From 8bf0c355f4e95b4fc2f3a9c6a50b107f1984c0f4 Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Sun, 21 Feb 2016 14:59:19 -0800 Subject: [PATCH] Fix examples so they build on gcc 4.6 --- examples/dns_stats.cpp | 17 ++++++++++------- examples/traceroute.cpp | 5 ++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/examples/dns_stats.cpp b/examples/dns_stats.cpp index 3d4a850..a2da49d 100644 --- a/examples/dns_stats.cpp +++ b/examples/dns_stats.cpp @@ -31,6 +31,9 @@ #define NOMINMAX #endif // _WIN32 +// Fix for gcc 4.6 +#define _GLIBCXX_USE_NANOSLEEP + #include #include #include @@ -65,8 +68,8 @@ using namespace Tins; template class statistics { public: - using duration_type = Duration; - using locker_type = lock_guard; + typedef Duration duration_type; + typedef lock_guard locker_type; struct information { duration_type average, worst; @@ -108,18 +111,18 @@ private: class dns_monitor { public: // The response times are measured in milliseconds - using duration_type = milliseconds; + typedef milliseconds duration_type; // The statistics type used. - using statistics_type = statistics; + typedef statistics statistics_type; void run(BaseSniffer& sniffer); const statistics_type& stats() const { return m_stats; } private: - using packet_info = tuple; - using clock_type = system_clock; - using time_point_type = clock_type::time_point; + typedef tuple packet_info; + typedef system_clock clock_type; + typedef clock_type::time_point time_point_type; bool callback(const PDU& pdu); static packet_info make_packet_info(const PDU& pdu, const DNS& dns); diff --git a/examples/traceroute.cpp b/examples/traceroute.cpp index fa92d08..cb78e3c 100644 --- a/examples/traceroute.cpp +++ b/examples/traceroute.cpp @@ -31,6 +31,9 @@ #define NOMINMAX #endif // _WIN32 +// Fix for gcc 4.6 +#define _GLIBCXX_USE_NANOSLEEP + #include #include #include @@ -128,7 +131,7 @@ private: } sender.send(ip); - // Give him a little time + // Give it a little time sleep_for(milliseconds(100)); } running = false;