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:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user