Hi all,
We have a requirement to manipulate some time variables. For example, add or subtract seconds, minutes, hours, days, months or years from a given time.
We've looked through the built in time functions and have not found functions which do this pre-existing.
Has anyone written a time library to handle these tasks available for use?
Kind regards,
Angus Heyworth
Is there a library of time manipulation functions available for use?
Search
Re: Is there a library of time manipulation functions available for use?
time t;
t=makeTime(1999,8,18,12,00);
Look up for "Time functions" in help.
t=makeTime(1999,8,18,12,00);
Look up for "Time functions" in help.
Re: Is there a library of time manipulation functions available for use?
A time variable in WinCC OA is an analog value counting the seconds since 1970.01.01 00:00.
If you want to modify the time you can do this by mathematical operations.
E.g. adding 10 seconds to a given time.
time tValue;
// read the current time
tValue = getCurrentTime();
// add 10 seconds (as integer value)
tValue = tValue + 10;
Doing mathematical operations is also possible with variables of type "time".
E.g. getting the difference between two times;
time t1, t2;
float fDiff;
t1 = getCurrentTime();
delay(5,5);
t2 = getCurrentTime();
fDiff = t2 - t1;
Best Regards
Leopold Knipp
Senior Support Specialist
If you want to modify the time you can do this by mathematical operations.
E.g. adding 10 seconds to a given time.
time tValue;
// read the current time
tValue = getCurrentTime();
// add 10 seconds (as integer value)
tValue = tValue + 10;
Doing mathematical operations is also possible with variables of type "time".
E.g. getting the difference between two times;
time t1, t2;
float fDiff;
t1 = getCurrentTime();
delay(5,5);
t2 = getCurrentTime();
fDiff = t2 - t1;
Best Regards
Leopold Knipp
Senior Support Specialist