SYSTEMTIME_TO_DCTIME

SYSTEMTIME_TO_DCTIME 1:

This function converts the structured "Windows System Time" variable to the 64 bit "Distributed Clock System Time" variable. If conversion fails the return value is zero.

FUNCTION SYSTEMTIME_TO_DCTIME: T_DCTIME

T_DCTIME

VAR_INPUT
    in    : TIMESTRUCT;
    micro : WORD(0..999); (* Microseconds: 0..999 *)
    nano  : WORD(0..999); (* Nanoseconds: 0..999 *)
END_VAR

in: The "Windows System Time" variable to be converted.

micro: Microseconds.

nano: Nanoseconds.

 

Example:

PROGRAM P_TEST
VAR
    syst : TIMESTRUCT := ( wYear := 2009, wMonth := 9, wDay := 16, wHour := 12, wMinute := 22, wSecond := 44, wMilliseconds := 123 );
END_VAR
dct := SYSTEMTIME_TO_DCTIME( syst, 456, 789 );

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v2.10.0 Build > 1340
TwinCAT v2.11.0 Build > 1536

PC or CX (x86, ARM)

TcEtherCAT.Lib
( Standard.Lib; TcBase.Lib; TcSystem.Lib, TcUtilities.Lib are included automatically )