1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-29 13:04:28 +01:00

Added Timestamp conversion to std::chrono::microseconds. BaseSniffer is now movable.

This commit is contained in:
Matias Fontanini
2012-11-23 20:30:16 -03:00
parent b74a353c17
commit 75a4bbfed6
8 changed files with 120 additions and 4 deletions

View File

@@ -31,6 +31,10 @@
#define TINS_TIMESTAMP_H
#include <sys/time.h>
#include "cxxstd.h"
#if TINS_IS_CXX11
#include <chrono>
#endif
namespace Tins {
/**
@@ -62,6 +66,15 @@ public:
suseconds_t microseconds() const {
return tv.tv_usec;
}
#if TINS_IS_CXX11
/**
* Converts this Timestamp to a std::chrono::microseconds
*/
operator std::chrono::microseconds() const {
return std::chrono::microseconds(seconds() * 1000000 + microseconds());
}
#endif
private:
timeval tv;
};