Vanetza
Loading...
Searching...
No Matches
clock.hpp
1#ifndef CLOCK_HPP_2FCBLXSJ
2#define CLOCK_HPP_2FCBLXSJ
3
4#include <boost/date_time/posix_time/posix_time_types.hpp>
5#include <chrono>
6#include <cstdint>
7#include <ratio>
8
9namespace vanetza
10{
11
12/**
13 * A Clock similar to std::chrono with epoch at 2004-01-01 at midnight
14 */
15class Clock
16{
17public:
18 typedef int64_t rep;
19 typedef std::ratio<1, 1000 * 1000> period;
20 typedef std::chrono::duration<rep, period> duration;
21 typedef std::chrono::time_point<Clock> time_point;
22 typedef boost::posix_time::ptime date_time;
23
24 static constexpr bool is_steady() { return true; }
25 static time_point at(const date_time&);
26 static date_time at(const time_point&);
27 static const date_time& epoch();
28
29 /**
30 * \brief create time point
31 * \param at time string formatted like 2016-07-15 09:48:32
32 * \return time point
33 */
34 static time_point at(const std::string& at);
35};
36
37} // namespace vanetza
38
39#endif /* CLOCK_HPP_2FCBLXSJ */
ChunckPacket is a packet consisting of several memory chunks.
ByteBufferConvertible & operator[](OsiLayer ol)
ChunkPacket & merge(ChunkPacket &packet, OsiLayer from, OsiLayer to)
std::size_t size() const
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
std::size_t size() 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
Definition byte_view.cpp:48
byte_view_range(ByteBuffer &&)
Definition byte_view.cpp:37
byte_view_range(const ByteBuffer::const_iterator &, const ByteBuffer::const_iterator &)
Definition byte_view.cpp:27
ByteBuffer::const_pointer data() const
Definition byte_view.cpp:42