System time setting

SETSYSTEMTIME

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

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

Input TypeDescription
systemTimeDT Time to be set
utc BOOLEnable 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)
OutputTypeDescription
INT value; result of time setting

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.

ValueDescription
0 Time was not set
1 Time was set successfully
  • © Energocentrum Plus, s.r.o. 2017 - 2024