[SOLVED] OS_TIME signed variable?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] OS_TIME signed variable?

    Hi,

    is there a reason why OS_TIME in embOS is designed as a signed variable?

    In most operating systems, unsigned times are used (e.g. GetTickCount(), clock_gettime(),...).
    Beside the (usually insignificant) reason that maximum timeouts are only half of unsigned timers, I always need to check for timer overflows myself when working with time differences?! X(

    Or am I am getting something wrong? :wacko:

    regards
    Martin
  • Hi Martin,

    we are using signed time values and calculate timeouts with subtractions.
    This make it's easy to handle overflows which means all timing functions just works (even if there is an overflow).

    I always need to check for timer overflows myself when working with time differences?!

    No, you don't have to check anything by yourself.
    You can just use embOS API like e.g. OS_Delay() and it will always works.

    Best regards,
    Til