DecomposeTimestampOperator Class
(Automation::DecomposeTimestampOperator)The DecomposeTimestampOperator decomposes the input timestamp into date and time basic parts. More...
Header: | #include <DecomposeTimestampOperator.h> |
Inherits: | CDPOperator<T> |
Public Functions
DecomposeTimestampOperator(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 DecomposeTimestampOperator decomposes the input timestamp into date and time basic parts.
Note: You can use Timestamp as input to DecomposeTimestamp to get current timestamp as date and time basic parts (instead of seconds).
Arguments
Name | Description |
---|---|
In | Timestamp in seconds including milliseconds as decimal places of the value |
UTC | When set to true (default) output values using UTC timezone, otherwise output values using local timezone |
Sec | Seconds (0.0-59.999999) corresponding to the input timestamp |
Min | Minutes (0-59) corresponding to the input timestamp |
Hour | Hours (0-23) corresponding to the input timestamp |
Day | Day of the month corresponding to the input timestamp |
Mon | Month number (1-12) corresponding to the input timestamp |
Year | Year (4-digit) corresponding to the input timestamp |
DoW | Day of the week corresponding to the input timestamp
|
DoY | Day of the year (0-365) corresponding to the input timestamp |
DST | Is set to true when local timezone was used (UTC was set to false ) and Daylight Saving Time (DST) is in effect |
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 DecomposeTimestampOperator
unsigned int DecomposeTimestampOperator<double>::Process() { if (!m_utc || !m_sec || !m_min || !m_hour || !m_day || !m_mon || !m_year || !m_dow || !m_doy || !m_dst ) return STATUS_ERROR; double timeStamp = (double)m_input; int64_t t = floor(timeStamp); tm t_tm; int error; if ((bool)*m_utc) error = OSAPIGMTime(&t_tm, &t); else error = OSAPILocalTime(&t_tm, &t); if (error) { GetParent()->ReportConfigurationFault(this, "Input timestamp " + to_string(timeStamp) + " can not be broken into component: " + strerror(error)); m_faultReported = true; return STATUS_ERROR; } *m_sec = t_tm.tm_sec + (timeStamp - t); *m_min = t_tm.tm_min; *m_hour = t_tm.tm_hour; *m_day = t_tm.tm_mday; *m_mon = t_tm.tm_mon + 1; *m_year = t_tm.tm_year + 1900; *m_dow = t_tm.tm_wday; *m_doy = t_tm.tm_yday; *m_dst = t_tm.tm_isdst; m_output = m_input; if (m_faultReported) { GetParent()->ClearConfigurationFault(this); m_faultReported = false; } return STATUS_OK; }
See also Argument.
Member Function Documentation
DecomposeTimestampOperator::DecomposeTimestampOperator(const CDPPropertyBase &in)
Default constructs an instance of DecomposeTimestampOperator.
[override virtual]
void DecomposeTimestampOperator::Configure(XMLPrimitive *operatorXML)
[override virtual]
unsigned int DecomposeTimestampOperator::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.