Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test time:Fixed bad assumption about RAND_MAX #11414

Merged
merged 1 commit into from
Feb 8, 2019
Merged

Conversation

davids5
Copy link
Member

@davids5 davids5 commented Feb 8, 2019

usleep range was up to 2147 Seconds

Per open group: The rand() function shall compute a
sequence of pseudo-random integers in the range
[0, {RAND_MAX}] with a period of at least 2^32

{RAND_MAX} Maximum value returned by rand();
at least 32767.

/* Maximum value returned by rand(). Must be a minimum of 32767. */

#define RAND_MAX INT_MAX

and

#define INT_MAX 2147483647

Fixes #11361

@dagar , @LorenzMeier this bad assumption may be repeated in PX4 in other places.

   usleep range was up to 2147 Seconds

   Per open group: The rand() function shall compute a
   sequence of pseudo-random integers in the range
   [0, {RAND_MAX}]  with a period of at least 2^32

   {RAND_MAX} Maximum value returned by rand();
   at least 32767.

   /* Maximum value returned by rand().  Must be a minimum of 32767. */

   #define RAND_MAX INT_MAX

  and

  #define INT_MAX     2147483647
@dagar dagar merged commit c6edf41 into master Feb 8, 2019
@dagar dagar deleted the master_time_test branch February 8, 2019 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants