diff options
author | Angelo Mantellini <manangel@cisco.com> | 2019-01-30 12:11:34 +0100 |
---|---|---|
committer | Angelo Mantellini <manangel@cisco.com> | 2019-01-30 15:23:44 +0100 |
commit | e5145b878f9de35676085409878a66899d2ee4f2 (patch) | |
tree | 177f77810901921ee03d1d3b850600c5f2cd1ef9 /libtransport/src/hicn/transport/protocols/raaqm_data_path.cc | |
parent | 30061551cd39c9f30280bfa0cf3cc909f4fac015 (diff) |
[HICN-18] first commit of libtransport for windows
Change-Id: I3a43b22194aa13ae5de1746e3d4bd9a275070261
Signed-off-by: Angelo Mantellini <manangel@cisco.com>
Diffstat (limited to 'libtransport/src/hicn/transport/protocols/raaqm_data_path.cc')
-rw-r--r--[-rwxr-xr-x] | libtransport/src/hicn/transport/protocols/raaqm_data_path.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libtransport/src/hicn/transport/protocols/raaqm_data_path.cc b/libtransport/src/hicn/transport/protocols/raaqm_data_path.cc index f876cf4f8..2e7aa531a 100755..100644 --- a/libtransport/src/hicn/transport/protocols/raaqm_data_path.cc +++ b/libtransport/src/hicn/transport/protocols/raaqm_data_path.cc @@ -42,10 +42,9 @@ RaaqmDataPath::RaaqmDataPath(double drop_factor, raw_data_bytes_received_(0), last_raw_data_bytes_received_(0), rtt_samples_(samples_), + last_received_pkt_(std::chrono::steady_clock::now()), average_rtt_(0), - alpha_(ALPHA) { - gettimeofday(&m_last_received_pkt_, 0); -} + alpha_(ALPHA) {} RaaqmDataPath &RaaqmDataPath::insertNewRtt(uint64_t new_rtt) { rtt_ = new_rtt; @@ -59,7 +58,7 @@ RaaqmDataPath &RaaqmDataPath::insertNewRtt(uint64_t new_rtt) { prop_delay_ = rtt_min_; } - gettimeofday(&m_last_received_pkt_, 0); + last_received_pkt_ = std::chrono::steady_clock::now(); return *this; } @@ -144,9 +143,9 @@ bool RaaqmDataPath::newPropagationDelayAvailable() { unsigned int RaaqmDataPath::getPropagationDelay() { return prop_delay_; } bool RaaqmDataPath::isStale() { - struct timeval now; - gettimeofday(&now, 0); - double time = getMicroSeconds(now) - getMicroSeconds(m_last_received_pkt_); + TimePoint now = std::chrono::steady_clock::now(); + auto time = std::chrono::duration_cast<Microseconds>(now - last_received_pkt_) + .count(); if (time > 2000000) { return true; } |