SYSTEMTIME_TO_DCTIME64

SYSTEMTIME_TO_DCTIME64 1:

The function converts a structured Windows system time variable of type TIMESTRUCT to a 64-bit distributed clock system time variable of type T_DCTIME64. In the event of a conversion error the function returns the value zero.

FUNCTION SYSTEMTIME_TO_DCTIME64: T_DCTIME64

SYSTEMTIME_TO_DCTIME64 2: Inputs

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

Name

Type

Description

in

TIMESTRUCT

The "Windows System Time" variable to be converted

micro

WORD

Microseconds

nano

WORD

Nanoseconds

Sample:

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_DCTIME64( syst, 456, 789 );

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_EtherCAT