OpenRTM-aist  1.2.1
Timestamp.h
Go to the documentation of this file.
1 // -*- C++ -*-
18 #ifndef RTM_TIMESTAMP_H
19 #define RTM_TIMESTAMP_H
20 
21 #include <rtm/ConnectorListener.h>
22 
23 namespace RTC
24 {
25  template <class DataType>
26  class Timestamp
27  : public ConnectorDataListenerT<DataType>
28  {
29  USE_CONNLISTENER_STATUS;
30  public:
31  Timestamp(const char* ts_type) : m_tstype(ts_type) {}
32  virtual ~Timestamp() {}
33  virtual ReturnCode operator()(ConnectorInfo& info, DataType& data)
34  {
35  if (info.properties["timestamp_policy"] != m_tstype)
36  {
37  return NO_CHANGE;
38  }
40  data.tm.sec = tm.sec();
41  data.tm.nsec = tm.usec() * 1000;
42  return DATA_CHANGED;
43  }
44  std::string m_tstype;
45  };
46 }; // End of namesepace RTM
47 
48 #endif // RTM_TIMESTAMP_H
Timestamp(const char *ts_type)
Definition: Timestamp.h:31
coil::Properties properties
Connection properties.
Definition: ConnectorBase.h:126
RT-Component.
long int sec() const
Get value of second time scale.
Definition: TimeValue.h:110
virtual ReturnCode operator()(ConnectorInfo &info, DataType &data)
Virtual Callback method.
Definition: Timestamp.h:33
Definition: ConnectorBase.h:43
Definition: Timestamp.h:26
virtual ~Timestamp()
Definition: Timestamp.h:32
Definition: ConnectorListener.h:68
TimeValue class.
Definition: TimeValue.h:40
int gettimeofday(struct timeval *tv, struct timezone *tz)
Get the time and timezone.
Definition: Time.h:137
ConnectorDataListenerT class.
Definition: ConnectorListener.h:505
std::string m_tstype
Definition: Timestamp.h:44
long int usec() const
Get value of micro second time scale.
Definition: TimeValue.h:131
connector listener class
Definition: ConnectorListener.h:66