mirror of
https://github.com/mfontanini/libtins
synced 2026-01-22 18:25:57 +01:00
Fix examples so they build on gcc 4.6
This commit is contained in:
@@ -31,6 +31,9 @@
|
||||
#define NOMINMAX
|
||||
#endif // _WIN32
|
||||
|
||||
// Fix for gcc 4.6
|
||||
#define _GLIBCXX_USE_NANOSLEEP
|
||||
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <chrono>
|
||||
@@ -65,8 +68,8 @@ using namespace Tins;
|
||||
template<typename Duration>
|
||||
class statistics {
|
||||
public:
|
||||
using duration_type = Duration;
|
||||
using locker_type = lock_guard<mutex>;
|
||||
typedef Duration duration_type;
|
||||
typedef lock_guard<mutex> 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<duration_type>;
|
||||
typedef statistics<duration_type> statistics_type;
|
||||
|
||||
void run(BaseSniffer& sniffer);
|
||||
const statistics_type& stats() const {
|
||||
return m_stats;
|
||||
}
|
||||
private:
|
||||
using packet_info = tuple<IPv4Address, IPv4Address, uint16_t>;
|
||||
using clock_type = system_clock;
|
||||
using time_point_type = clock_type::time_point;
|
||||
typedef tuple<IPv4Address, IPv4Address, uint16_t> 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);
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
#define NOMINMAX
|
||||
#endif // _WIN32
|
||||
|
||||
// Fix for gcc 4.6
|
||||
#define _GLIBCXX_USE_NANOSLEEP
|
||||
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
@@ -128,7 +131,7 @@ private:
|
||||
}
|
||||
|
||||
sender.send(ip);
|
||||
// Give him a little time
|
||||
// Give it a little time
|
||||
sleep_for(milliseconds(100));
|
||||
}
|
||||
running = false;
|
||||
|
||||
Reference in New Issue
Block a user