I’m looking to manipulate time vars a bit in a CoDeSys project. (Like add 24 hours to a DT then compare it to the current time.)
I saw this thread:
and tried using SysTime for getting the current time. That seems to work fine, but I would like to do some date manipulation and the SysTime doesn’t have that. Whats the easiest way to convert the results from SysTime to a standard DT object? Or is there a better way to do this?
I would recommend checking out the OSCAT library functions regarding Date and Time. The OSCAT Library is an open source catalog of functions, and are included in the Opto 22 Codesys Runtime.
Yes. OSCAT looks good for manipulation, but I don’t see a way to retrieve from the clock with OSCAT, which is understandable in an opensource library used by multiple manufactures…
SysTime gives the current time, but doesn’t give it in the built-in types. (Is there a reason for this? To me using the built-in types would be a no-brainer.)
So I’ll write a function block to convert the SysTime output into DT and TOD with OSCAT functions but I’d prefer to use something that’s already written if it exists.