SYSTEMTIME_TO_DCTIME

SYSTEMTIME_TO_DCTIME 1:

SYSTEMTIME_TO_DCTIME 2:

Outdated function

This function is outdated. Use the function SYSTEMTIME_TO_DCTIME64 instead.

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

FUNCTION SYSTEMTIME_TO_DCTIME: T_DCTIME

SYSTEMTIME_TO_DCTIME 3: 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_DCTIME( syst, 456, 789 );

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_EtherCAT