common: extend timestamp interface for byte_buffer

* allow setting timestamp to a specific std::chrono::time_point
* add getter from raw tp
This commit is contained in:
Andre Puschmann 2020-12-16 22:01:28 +01:00
parent 81cfce6cf0
commit 2e64fff1df
1 changed files with 8 additions and 0 deletions

View File

@ -155,6 +155,8 @@ public:
#endif
}
std::chrono::high_resolution_clock::time_point get_timestamp() { return tp; }
void set_timestamp()
{
#ifdef ENABLE_TIMESTAMP
@ -163,6 +165,12 @@ public:
#endif
}
void set_timestamp(std::chrono::high_resolution_clock::time_point tp_)
{
tp = tp_;
timestamp_is_set = true;
}
void append_bytes(uint8_t* buf, uint32_t size)
{
memcpy(&msg[N_bytes], buf, size);