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

SUB_TOD_TIME

Function Name

SUB_TOD_TIME

Description

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

Arguments

Input 1 {TIME_OF_DAY}

Input 2 {TIME}

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

Returns

Output {TIME_OF_DAY}

The Output is the result of Input 1 - Input 2

Example:

Function Block Diagram - SUB_TOD_TIME:

A NOW function is used to provide the current time for a SUB_TOD_TIME 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_TIME function.

For its other input, the SUB_TOD_TIME function has a constant that is set to T#35m (35 minutes):

The SUB_TOD_TIME function returns a time value that is the result of the current time - 35 minutes.

ST Program - SUB_TOD_TIME:

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

  • Output := SUB_TOD_TIME (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 value, and the Output is a time of day value.


ClearSCADA 2015 R2