Friday, September 22nd 2017, 7:09pm UTC+2

You are not logged in.

  • Login
  • Register

makani

Beginner

Date of registration: May 26th 2014

Posts: 1

1

Monday, June 19th 2017, 12:20pm

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

SEGGER - Til

Super Moderator

Date of registration: Nov 14th 2007

Posts: 254

2

Monday, June 19th 2017, 12:27pm

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).

Quoted

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