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
8
class
ReadTimestamp
9
{
10
public
:
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
};
MonotonicClock.h
ReadTimestamp
Byte streams preserve the producer receipt time across buffering and decoding.
Definition
ReadTimestamp.h:9
ReadTimestamp::~ReadTimestamp
virtual ~ReadTimestamp()=default
ReadTimestamp::from
static quint64 from(const QIODevice *device, quint64 fallbackTimestampUs=nowUs())
Definition
ReadTimestamp.h:18
ReadTimestamp::nowUs
static quint64 nowUs()
Definition
ReadTimestamp.h:11
ReadTimestamp::lastReadTimestampUs
virtual quint64 lastReadTimestampUs() const =0
MonotonicClock::nowUs
uint64_t nowUs()
Definition
MonotonicClock.h:10
src
Utilities
IO
ReadTimestamp.h
Generated by
1.9.8