NT_SetTimeToRTCTime
This functionality is not available in the PLC runtime system under Windows CE! |
The function block NT_SetTimeToRTCTime can be used to synchronize the local Windows system time (displayed in the taskbar) with the real-time clock of the PC (RTC time in the BIOS).
Comments
When the function block is called, the real-time clock of the TwinCAT PC is compared with the local Windows system time, and the local Windows system time is corrected by the difference. Time zones and summer time are taken into account. Please note that the correction can lead to time jumps during measurements or logbook entries.
When the local Windows system time is set, the operating system automatically sets the RTC time to the new local Windows system time. Due to the conversion and delay the new RTC time is inevitably subject to a small error. The error is in the millisecond range. I.e. each time NT_SetTimeToRTCTime is called a small error is introduced in the real-time clock. In order to minimize deviations over a prolonged period, the calibration should be carried out every 24 hours, for example, rather than during each PLC cycle.
Inputs
VAR_INPUT
NETID : T_AmsNetId;
SET : BOOL;
TMOUT : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR
Name | Type | Description |
---|---|---|
NETID | T_AmsNetID | The network address of the TwinCAT computer on which the local Windows system time is to be synchronized can be specified here. For the local computer an empty string may be specified. |
SET | BOOL | The function block is enabled by a positive edge at this input. |
TMOUT | TIME | Time-out period that may not be exceeded when executing the ADS command. |
Outputs
VAR_OUTPUT
BUSY : BOOL;
ERR : BOOL;
ERRID : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
BUSY | BOOL | When the function block is enabled, this output is set and remains set until a feedback is received. |
ERR | BOOL | If an error should occur during the transfer of the command, then this output is set once the BUSY output was reset. |
ERRID | Returns the error code, if the ERR output is set. |
Further time and time zone functions and function blocks:
Requirements
Development environment | Target platform | PLC libraries to be integrated (category group) |
---|---|---|
TwinCAT v3.1.0 | PC or CX (WES7/Win7/Win10: TC RT x86/x64) | Tc2_Utilities (System) |