FILETIME_TO_SYSTEMTIME

FILETIME_TO_SYSTEMTIME 1:

The function  "FILETIME_TO_SYSTEMTIME" converts time from FILETIME format  into the "readable" SYSTEMTIME format. The conversion fails if the most significant bit of 64 bit file Time variables is set. In this case the TIMESTRUCT member variables have the value zero.

FUNCTION FILETIME_TO_SYSTEMTIME: TIMESTRUCT

TIMESTRUCT

VAR_INPUT
    fileTime        : T_FILETIME;
END_VAR

fileTime:: Time to convert in FILETIME format

Example in ST:

PROGRAM MAIN
VAR
    fbSystemTime     : GETSYSTEMTIME;
    timeAsFileTime   : T_FILETIME;
    timeAsSystemTime : TIMESTRUCT;
END_VAR
(* program code *)
fbSystemTime( timeLoDW =>timeAsFileTime.dwLowDateTime , timeHiDW =>timeAsFileTime.dwHighDateTime );
timeAsSystemTime := FILETIME_TO_SYSTEMTIME( timeAsFileTime );

Requirements

Development environment

Target System

PLC libraries to include

TwinCAT v2.9.0 Build > 1031 and higher

TwinCAT v2.10.0 Build > 1240 and higher

PC or CX (x86)

TcUtilities.Lib

( Standard.Lib; TcBase.Lib; TcSystem.Lib are included automatically )

TwinCAT v2.10.0 Build >= 1301

CX (ARM)