[ECOS] Macro to convert milliseconds into ticks

Nick Garnett nickg@ecoscentric.com
Thu Nov 20 11:58:00 GMT 2008

Simon Kallweit <simon.kallweit@intefo.ch> writes:

> Hi
> I was looking for a macro to convert fix millisecond intervals into
> tick counts to be used for cyg_thread_delay(). I didn't found it, and
> was wondering if there is anything against introducing such a macro?

The problem with this is that while you want to convert to/from
millisecond, others might want microseconds, or nanoseconds, or
seconds+microseconds, or seconds+nanoseconds, or fixed or floating
point fractions. Which of these do we supply? If we only supply a
subset, then users still have to convert. Instead we supply the basic
tools and let users do their own conversions. There are several
examples of how to do this in the sources (in tests like tm_basic, and
in the POSIX library) and there is support for creating time
convertors to encapsulate the calculations.

On a more general note, we do have to be careful in the eCos sources
with what we include. If we just added every function and macro that
anybody might find useful we would end up with an enormous API, like
Windows. Nobody wants that. Instead we need to keep the API as small
as possible. The result of that is that occasionally users have to
write code to adapt the API to what they need.

Nick Garnett                                      eCos Kernel Architect
eCosCentric Limited    http://www.eCosCentric.com      The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.     Tel: +44 1223 245571
Registered in England and Wales:                        Reg No: 4422071

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list