Skip to content

Commit cbaba16

Browse files
author
Damir Zainullin
committed
TCP RTT - Update time constants
1 parent 74396a4 commit cbaba16

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/plugins/process/tcpRtt/src/tcpRtt.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <limits>
1414
#include <memory>
1515
#include <sstream>
16+
#include <chrono>
1617

1718
#include <ipfixprobe/flowifc.hpp>
1819
#include <ipfixprobe/ipfix-basiclist.hpp>
@@ -24,6 +25,8 @@
2425
#include "fields.h"
2526
#endif
2627

28+
using namespace std::chrono_literals;
29+
2730
namespace ipxp {
2831

2932
#define TCPRTT_UNIREC_TEMPLATE "TCPRTT_TIME"
@@ -36,8 +39,8 @@ UR_FIELDS(uint64 TCPRTT_TIME)
3639
*/
3740
constexpr static inline uint64_t timeval_to_msec(timeval timeval) noexcept
3841
{
39-
constexpr size_t MSEC_IN_SEC = 1'000;
40-
constexpr size_t USEC_IN_MSEC = 1'000;
42+
constexpr std::size_t MSEC_IN_SEC = std::chrono::milliseconds(1s).count();
43+
constexpr std::size_t USEC_IN_MSEC = std::chrono::microseconds(1ms).count();
4144
return timeval.tv_sec * MSEC_IN_SEC + timeval.tv_usec / USEC_IN_MSEC;
4245
}
4346

0 commit comments

Comments
 (0)