Fix pcap import/replay inter packet timing
Changed to decimal precision for improved replay accuracy. For inter packet time > 1s, the integer precision would set up rate as 0 instead of 0.x - this also gets fixed by this change.
This commit is contained in:
parent
cb9b648c71
commit
8547eb8bb8
@ -480,7 +480,7 @@ _non_pdml:
|
||||
stream->mutable_control()->set_num_packets(1);
|
||||
|
||||
// setup packet rate to the timing in pcap (as close as possible)
|
||||
const uint kUsecsInSec = uint(1e6);
|
||||
const double kUsecsInSec = 1e6;
|
||||
uint usec = (pktHdr.tsSec*kUsecsInSec + pktHdr.tsUsec);
|
||||
uint delta = usec - lastUsec;
|
||||
|
||||
|
@ -177,7 +177,7 @@ void PdmlFrameProtocol::unknownFieldHandler(QString name, int /*pos*/,
|
||||
|
||||
if (decimal >= 0)
|
||||
{
|
||||
const uint kNsecsInSec = 1000000000;
|
||||
const double kNsecsInSec = 1e9;
|
||||
uint sec = delta.left(decimal).toUInt();
|
||||
uint nsec = delta.mid(decimal+1).toUInt();
|
||||
uint ipg = sec*kNsecsInSec + nsec;
|
||||
|
Loading…
Reference in New Issue
Block a user