DCTIMESTRUCT_TO_DCTIME

DCTIMESTRUCT_TO_DCTIME 1:

This function converts the structured variable of type: DCTIMESTRUCT to the 64 bit "Distributed Clock System Time" variable.
The wDayOfWeek member of the structured variable is ignored.  The wYear member must be greater or equal than 2000 and cannot be greater than 2585. If conversion fails the return value is zero.

FUNCTION DCTIMESTRUCT_TO_DCTIME: T_DCTIME

T_DCTIME

VAR_INPUT
    in : DCTIMESTRUCT;
END_VAR

in: The variable to be converted.

Example:

PROGRAM P_TEST
VAR
    dcStruct : DCTIMESTRUCT := (    wYear := 2008, wMonth := 3, wDay := 13,
                    wHour := 1, wMinute := 2, wSecond :=3,
                    wMilliseconds := 123, wMicroseconds := 456, wNanoseconds := 789 );
    dc64    : T_DCTIME;
END_VAR
dc64 := DCTIMESTRUCT_TO_DCTIME( dcStruct );

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v2.10.0 Build >= 1324 or higher

PC or CX (x86, ARM)

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