Skip to content

Commit 90e2517

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

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
@@ -10,6 +10,7 @@
1010

1111
#pragma once
1212

13+
#include <chrono>
1314
#include <limits>
1415
#include <memory>
1516
#include <sstream>
@@ -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)