I am currently working on a project where i need to subtract time stamps to determine the duration of a process.
I am taking a Time Stamp with the PLCNEXT_BASEFB and then I want to subtract a later time stamp to get duration.
Has anyone done this yet?? Is there a FB out there that takes care of it?
I tried searching but didn’t see anything on the forum.
Hi zackbell,
maybe one of these FBs will work
BR
DivisionByZero
LDT_DIF_TIMESTAMP.zipHi. Please find my thoughts about your question attached. (Project for IDE 2024.0.3 LTS)
Attached sample does not require external libraries.
изображение.pngThe quenue of transformation is:
RTC → LDT → UNIX timestamp (ULINT) → LTIME
This realization allow you to store exact time of event occurrence, and receive time distance of two events with „nanosecond“ precision.
BR
LDT_DIF_TIMESTAMP.zip
Actually, same functionality will provide FC SUB_LDT_LDT, mentioned by DivisionByZero.
Cheers
Thank you both! I didn’t even see those functions.