[Bug 1894] missing a tick in _Timespec_To_ticks

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Fri Sep 2 16:55:41 UTC 2011


https://www.rtems.org/bugzilla/show_bug.cgi?id=1894

--- Comment #23 from Gedare <giddyup44 at yahoo.com> 2011-09-02 11:55:38 CDT ---
(In reply to comment #20)
> The (a + b - 1) / b may lead to an integer overflow, so we should avoid this
> here.  There are some integer conversion warnings in timespectoticks.c:
> 
> timespectoticks.c: In function '_Timespec_To_ticks':
> timespectoticks.c:48:31: warning: conversion to 'long unsigned int' from
> 'time_t' may change the sign of the result [-Wsign-conversion]
> timespectoticks.c:50:31: warning: conversion to 'long unsigned int' from 'long
> int' may change the sign of the result [-Wsign-conversion]
> timespectoticks.c:52:13: warning: conversion to 'long unsigned int' from 'long
> int' may change the sign of the result [-Wsign-conversion]

Is the overflow possible in timespectotick? I believe tv_nsec is bounded
somehow (less than 1000000000 or so)? And nsec per tick can be reasonably
bounded. If so we can do some math to convince ourselves. For the general
utility functions to convert ms to ticks for example the overflow is a problem
I suppose.

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list