SYSTEMTIME_TO_DT
The "SYSTEMTIME_TO_DT" function allows the Windows system time structure to be converted to the DATE_AND_TIME format (DT) usual in a PLC. The system time has a resolution of 1ms, while the resolution of DATE_AND_TIME is 1s. The milliseconds from the system time are used in the course of the conversion to determine the direction of rounding for the returned DATE_AND_TIME value.
FUNCTION SYSTEMTIME_TO_DT : DT
VAR_INPUT
TIMESTR :TIMESTRUCT;
END_VAR
TIMESTR: structure with the Windows system time to be converted.
Sample of a call in FBD:
PROGRAM SystemTimeTest
VAR
SystemTimeStruct :TIMESTRUCT;
DTFromSystemTime :DT;
END_VAR
Requirements
Development environment |
Target platform |
PLC libraries to include |
---|---|---|
TwinCAT v2.7.0 and above |
BCxxxx (165) |
Standard.Lb6, PlcSystemBC.Lb6, TcPlcUtilitiesBC.Lb6 |
See also