ComposeTimestampOperator Class
(Automation::ComposeTimestampOperator)The ComposeTimestampOperator composes and outputs timestamp from date and time basic parts. More...
Header: | #include <ComposeTimestampOperator.h> |
Inherits: | CDPOperator<T> |
Public Functions
ComposeTimestampOperator(const CDPPropertyBase &in) |
Reimplemented Public Functions
- 18 public functions inherited from CDPOperator
- 17 public functions inherited from CDPOperatorBase
- 46 public functions inherited from CDPBaseObject
- 26 public functions inherited from CDP::StudioAPI::CDPNode
- 22 public functions inherited from CDP::StudioAPI::ICDPNode
Additional Inherited Members
- 1 public variable inherited from CDPOperatorBase
- 1 static public member inherited from CDPBaseObject
- 1 protected function inherited from CDP::StudioAPI::CDPNode
- 8 protected variables inherited from CDPOperator
- 5 protected variables inherited from CDPOperatorBase
- 11 protected variables inherited from CDPBaseObject
Detailed Description
The ComposeTimestampOperator composes and outputs timestamp from date and time basic parts.
Arguments
Name | Description |
---|---|
UTC | When set to true (default) date and time components are using UTC timezone, otherwise using local timezone |
Sec | Seconds (0.0-59.999999) part of the timestamp to be composed |
Min | Minutes (0-59) part of the timestamp to be composed |
Hour | Hours (0-23) part of the timestamp to be composed |
Day | Day of the month part of the timestamp to be composed |
Mon | Month number (1-12) part of the timestamp to be composed |
Year | Year (4-digit) part of the timestamp to be composed |
Out | Timestamp in seconds including milliseconds as decimal places of the value |
When operator is used inside a signal its default input is automatically tied to signal's InternalValue or previous operator's output. Its default output is automatically tied to next operator's input or to signal's Value. See also CDP Operator Usage In CDP Signals.
Actual Processing Code of the ComposeTimestampOperator
unsigned int ComposeTimestampOperator<double>::Process() { if (!m_utc || !m_sec || !m_min || !m_hour || !m_day || !m_mon || !m_year ) return STATUS_ERROR; tm t_tm; memset(&t_tm, 0, sizeof(struct tm)); double seconds = (double)*m_sec; t_tm.tm_sec = floor(seconds); t_tm.tm_min = (unsigned short)*m_min; t_tm.tm_hour = (unsigned short)*m_hour; t_tm.tm_mday = (unsigned short)*m_day; t_tm.tm_mon = (unsigned short)*m_mon - 1; t_tm.tm_year = (unsigned short)*m_year - 1900; double timeStamp; if ((bool)*m_utc) timeStamp = OSAPIMKGMTime(&t_tm); else timeStamp = OSAPIMKTime(&t_tm); m_output = timeStamp + (seconds - t_tm.tm_sec); return STATUS_OK; }
See also Argument.
Member Function Documentation
ComposeTimestampOperator::ComposeTimestampOperator(const CDPPropertyBase &in)
Default constructs an instance of ComposeTimestampOperator.
[override virtual]
void ComposeTimestampOperator::Configure(XMLPrimitive *operatorXML)
[override virtual]
unsigned int ComposeTimestampOperator::Process()
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.