[JdeRobot] Doubt about timing in some threads

samartin samuel.martinm at gmail.com
Sat Mar 5 03:19:02 CET 2016


Hi,

In basic component, the timing of the thread is managed this way:

        if (diff < 0 || diff > cycle)
            diff = cycle;
        else
            diff = cycle - diff;

Diff is the amount of time that it takes to execute the code, and cycle, how
much time it should take the entirely cicle. What I do not understand is why
if the code takes more time to execute than the cycle, it waits even longer.
Wouldn't it be better to do something like this?:

        if (diff < 0 || diff > cycle_gui)
            diff = 0;
        else
            diff = cycle_gui - diff;

Samuel



--
View this message in context: http://jderobot-developer-list.2315034.n4.nabble.com/Doubt-about-timing-in-some-threads-tp4642950.html
Sent from the Jderobot Developer List mailing list archive at Nabble.com.


More information about the Jde-developers mailing list