astrotypes  0.0
Macros
DefineClock.h File Reference
#include "TimePoint.h"
#include <chrono>
Include dependency graph for DefineClock.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define Q(x)   #x
 macro to easily define std::chrono compaitble clocks More...
 
#define QUOTE(x)   Q(x)
 
#define PSS_UNITS_DEFINE_CLOCK(_name_, duration_before_epoch, _symbol_, _is_steady_)
 

Macro Definition Documentation

#define PSS_UNITS_DEFINE_CLOCK (   _name_,
  duration_before_epoch,
  _symbol_,
  _is_steady_ 
)
Value:
namespace detail { \
template<typename TimePoint> \
struct _name_##_implementation_t : public std::chrono::system_clock \
{ \
typedef TimePoint time_point; \
typedef decltype(duration_before_epoch) duration; \
static const duration diff_from_system_epoch; \
static time_point now() noexcept { \
return time_point(std::chrono::system_clock::now()); \
} \
}; \
\
template<typename TimePoint> \
const typename _name_##_implementation_t<TimePoint>::duration \
_name_##_implementation_t<TimePoint>::diff_from_system_epoch(duration_before_epoch); \
} \
\
struct _name_ : public detail::_name_##_implementation_t<TimePoint<_name_, decltype(duration_before_epoch)>> \
{ \
private: \
typedef _name_##_implementation_t<TimePoint<_name_, decltype(duration_before_epoch)>> BaseT; \
public: \
typedef typename BaseT::duration duration; \
typedef typename BaseT::time_point time_point; \
typedef duration::rep rep; \
typedef duration::period period; \
static constexpr bool is_steady = _is_steady_; \
static constexpr const char* symbol=QUOTE(_symbol_);\
\
}
#define QUOTE(x)
Definition: DefineClock.h:35

Definition at line 39 of file DefineClock.h.

#define Q (   x)    #x

macro to easily define std::chrono compaitble clocks

Definition at line 34 of file DefineClock.h.

#define QUOTE (   x)    Q(x)

Definition at line 35 of file DefineClock.h.