- minor improvements for pvqa_pcap project

This commit is contained in:
2025-01-30 17:44:12 +03:00
parent 34e43bf301
commit 5ce85e3a09
4 changed files with 8 additions and 2 deletions

View File

@@ -120,6 +120,11 @@ timespec chronox::toTimespec(uint64_t milliseconds)
return r;
}
uint64_t chronox::toTimestamp(const timeval& ts)
{
return ts.tv_sec * 1000 + ts.tv_usec / 1000;
}
int64_t chronox::getDelta(const timespec& a, const timespec& b)
{
uint64_t ms_a = a.tv_sec * 1000 + a.tv_nsec / 10000000;

View File

@@ -61,6 +61,7 @@ public:
// Converts number of milliseconds starting from Epoch begin to timespec.
static timespec toTimespec(uint64_t milliseconds);
static uint64_t toTimestamp(const timeval& ts);
// Returns difference between timestamps in milliseconds
static int64_t getDelta(const timespec& a, const timespec& b);