QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ReadTimestamp.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QIODevice>
4
5#include "MonotonicClock.h"
6
9{
10public:
11 static quint64 nowUs() { return MonotonicClock::nowUs(); }
12
13 virtual ~ReadTimestamp() = default;
14 virtual quint64 lastReadTimestampUs() const = 0;
15
18 static quint64 from(const QIODevice* device, quint64 fallbackTimestampUs = nowUs())
19 {
20 const auto* timestamped = dynamic_cast<const ReadTimestamp*>(device);
21 return timestamped ? timestamped->lastReadTimestampUs() : fallbackTimestampUs;
22 }
23};
Byte streams preserve the producer receipt time across buffering and decoding.
virtual ~ReadTimestamp()=default
static quint64 from(const QIODevice *device, quint64 fallbackTimestampUs=nowUs())
static quint64 nowUs()
virtual quint64 lastReadTimestampUs() const =0
uint64_t nowUs()