1#ifndef TIMESTAMP_HPP_SFETMZJI
2#define TIMESTAMP_HPP_SFETMZJI
4#include <vanetza/common/clock.hpp>
5#include <vanetza/geonet/serialization.hpp>
7#include <boost/operators.hpp>
8#include <boost/date_time/posix_time/posix_time.hpp>
9#include <boost/units/absolute.hpp>
10#include <boost/units/quantity.hpp>
11#include <boost/units/systems/si/time.hpp>
12#include <boost/units/make_scaled_unit.hpp>
22 typedef uint32_t value_type;
23 typedef boost::units::make_scaled_unit<
24 boost::units::si::time,
25 boost::units::scale<10, boost::units::static_rational<-3>>
27 typedef boost::units::absolute<unit_type> absolute_unit_type;
28 typedef boost::units::quantity<absolute_unit_type, value_type> time_type;
29 typedef boost::units::quantity<unit_type, value_type> duration_type;
31 static unit_type millisecond();
32 static boost::posix_time::ptime start_time();
34 Timestamp() : m_timestamp(0) {}
35 Timestamp(time_type t) : m_timestamp(t) {}
36 Timestamp(
const Clock::time_point&);
37 Timestamp(
const boost::posix_time::ptime&);
38 value_type raw()
const {
return m_timestamp.value(); }
39 time_type quantity()
const {
return m_timestamp; }
44
45
46
47
51
52
53
54
58 time_type m_timestamp;
ChunckPacket is a packet consisting of several memory chunks.
ByteBufferConvertible & operator[](OsiLayer ol)
ChunkPacket & merge(ChunkPacket &packet, OsiLayer from, OsiLayer to)
const ByteBufferConvertible & layer(OsiLayer ol) const
const ByteBufferConvertible & operator[](OsiLayer ol) const
ByteBufferConvertible & layer(OsiLayer ol)
std::size_t size(OsiLayer from, OsiLayer to) const
ChunkPacket extract(OsiLayer from, OsiLayer to)
std::size_t size(OsiLayer from, OsiLayer to) const
buffer_const_range operator[](OsiLayer layer) const
void set_boundary(OsiLayer, unsigned bytes)
const ByteBuffer & buffer() const
CohesivePacket(const ByteBuffer &buffer, OsiLayer layer)
void trim(OsiLayer from, unsigned bytes)
std::size_t size(OsiLayer single_layer) const
value_type operator[](size_type) const
byte_view_range(ByteBuffer &&)
byte_view_range(const ByteBuffer::const_iterator &, const ByteBuffer::const_iterator &)
ByteBuffer::const_pointer data() const
void encode(units::Duration)
units::Duration decode() const
bool after(const Timestamp &other) const
bool before(const Timestamp &other) const