You are here: Core Reference > Coding > Logic > SUB_TOD_TOD

SUB_TOD_TOD

Function Name

SUB_TOD_TOD

Description

Subtracts a time of day input from a time of day input to provide a time output.

Arguments

Input 1 {TIME_OF_DAY}

Input 2 {TIME_OF_DAY}

For more information on the data types for the inputs and outputs, see Data Type Hierarchy.

Returns

Output {TIME}

The Output is the result of Input 1 - Input 2

Example:

Function Block Diagram - SUB_TOD_TOD:

A NOW function is used to provide the current time for a SUB_TOD_TOD function. As the NOW function provides a date time value, a DT_TO_TOD function has to be used to convert the NOW output into a TOD value that can be used as an input by the SUB_TOD_TOD function.

For its other input, the SUB_TOD_TIME function has a constant that is set to TOD#16:00:23.144:

The SUB_TOD_TIME function returns a time value that is the result of the current time - 16:0023:144, that is, the difference in time between the current time and 16:0023:144.

ST Program - SUB_TOD_TOD:

The syntax for a SUB_TOD_TOD function in an ST Program is:

  • Output := SUB_TOD_TOD (Input 1, Input 2)

Where Output, Input 1 and Input 2 are defined as variables earlier in the ST program. Input 1 is a time of day value, Input 2 is a time of day value, and the Output is a time value.


ClearSCADA 2015 R2