I need to convert the timestruct I get from Beckhoffs function block "FB_LocalSystemTime" to milliseconds since epoch to receive the local computer time in milliseconds.
Unfortunately I can't find a function to convert this timestruct. Any help is appreciated.
//Local Systemtime variables
fbTime : FB_LocalSystemTime := ( bEnable := TRUE, dwCycle := 1 );
You can use the
SYSTEMTIME_TO_DT()function to convert a timestruct to dt which is a 4byteDATE_AND_TIMEdata type.The smallest unit of this data type is a second though and not a millisecond. Given that
TIMESTRUCThas a millisecond value in it, you can easily use it and concatenate everything to a human readable string.