Time Difference Processor¶
The “Time Difference Processor” is installed with the Dataristix Application. The processor accepts two inputs that are expected to be of a DateTime type or of a string type that is convertible to a DateTime. The processor calculates the difference between the two time stamps in seconds (with fractional part) and forwards the results.
Use the processor to debug task flows in combination with the “Timestamping Processor”.
Add to Task¶
Add the “Time Difference Processor” to a task by dragging it from the “Build” panel onto the task’s “Task Builder” panel.
![../../_images/processor-timedifference.png](../../_images/processor-timedifference.png)
Example¶
The following example shows a task that receives a signal from the Interval Timer input every two seconds. The signal passes through the Debounce processor which delays the signal by one second before it passes the signal onto the MQTT output.
A Timestamping processor also accepts the Interval Timer signal, generating a timestamp that is subsequently renamed to “Before” before feeding the “Before” timestamp into a Trigger processor for later use.
Another timestamp is generated when the signal leaves the Debounce processor. This timestamp is renamed to “After” and is then used to trigger forwarding of both, the “Before” and “After” timestamps onto the Time Difference processor. The Time Difference processor therefore measures the time it took for the Debounce processor to process the sample.
As expected, the processing time is around one second.
![../../_images/processor-timedifference-example.png](../../_images/processor-timedifference-example.png)
Note
If inputs arrive faster then the processing time, then the input timestamp may already be re-newed before the time difference is measured. This needs to be taken into account when designing the task flow.