[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
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.