Documentation

Set System Time

System time setting

Function name

SETSYSTEMTIME

ST call

PROGRAM TEST_SETSYSTEMTIME

VAR
system_time : dt;
utc : bool;
set_time : bool;
END_VAR

IF set_time THEN
setsystemtime(system_time, UTC);
set_time := FALSE;
END_IF;

END_PROGRAM

Description

The function sets the PLC system time to the requested value. It is used for controlled synchronisation of the internal PLC clock (RTC).

Inputs

Input Type Description
systemTime DT Time to be set
utc BOOL Enable time zone (If UTC = „false“, the value at the systemTime input is considered as local time according to the time zone defined in the PLC. If UTC = „true“, the UTC time is set)

Outputs

Output Type Description
=> INT value; result of time setting

Function

The setsystemtime function sets the PLC system time according to input variable systemTime. The input variable UTC changes between local time and UTC time. The function output => returns the result of the setting process.

Value Description
0 Time was not set
1 Time was set successfully