Go to the documentation of this file.
18 #ifndef RTM_TIMESTAMP_H
19 #define RTM_TIMESTAMP_H
45 template <
class DataType>
48 auto now = std::chrono::system_clock::now().time_since_epoch();
49 auto sec = std::chrono::duration_cast<std::chrono::seconds>(now);
50 auto nsec = std::chrono::duration_cast<std::chrono::nanoseconds>(now - sec);
52 data.tm.sec =
static_cast<decltype(data.tm.sec)
>(sec.count());
53 data.tm.nsec =
static_cast<decltype(data.tm.nsec)
>(nsec.count());
58 template <
class DataType>
62 USE_CONNLISTENER_STATUS;
72 setTimestamp<DataType>(data);
79 #endif // RTM_TIMESTAMP_H
@ NO_CHANGE
Definition: ConnectorListener.h:71
void setTimestamp(DataType &data)
Setting timestamp to data.
Definition: Timestamp.h:46
std::string m_tstype
Definition: Timestamp.h:75
@ DATA_CHANGED
Definition: ConnectorListener.h:73
ReturnCode operator()(ConnectorInfo &info, DataType &data) override
Virtual Callback method.
Definition: Timestamp.h:66
ConnectorInfo class.
Definition: ConnectorBase.h:49
ConnectorDataListenerT class.
Definition: ConnectorListener.h:513
Definition: Timestamp.h:59
Timestamp(const char *ts_type)
Definition: Timestamp.h:64
coil::Properties properties
Connection properties.
Definition: ConnectorBase.h:178
~Timestamp() override=default