[PATCH 06/16] confdefs: Warn about problematic ticks per second

Joel Sherrill joel at rtems.org
Mon Oct 23 14:47:45 UTC 2017


On Mon, Oct 23, 2017 at 8:53 AM, Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> A non-integer clock ticks per second value may lead to inaccurate time
> format conversions.
>
> Update #3117.
> Update #3182.
> ---
>  cpukit/sapi/include/confdefs.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/
> confdefs.h
> index 3dfcf9b2d5..13e97c9487 100755
> --- a/cpukit/sapi/include/confdefs.h
> +++ b/cpukit/sapi/include/confdefs.h
> @@ -2287,6 +2287,10 @@ extern rtems_initialization_tasks_table
> Initialization_tasks[];
>              RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
>    #endif
>
> +  #if 1000000 % CONFIGURE_MICROSECONDS_PER_TICK != 0
> +    #warning "The clock ticks per second is not an integer"
> +  #endif
> +
>

Good idea but if we are going down the paranoid error path, what about
negative
numbers?


>    #define _CONFIGURE_TICKS_PER_SECOND (1000000 /
> CONFIGURE_MICROSECONDS_PER_TICK)
>
>    /** The configures the number of clock ticks per timeslice. */
> --
> 2.12.3
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20171023/38707d65/attachment-0002.html>


More information about the devel mailing list