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

Add extern C and explicit cast in msleep function #340

Merged
merged 3 commits into from
May 30, 2017

Conversation

aflaischer
Copy link

@aflaischer aflaischer commented May 24, 2017

Hi,
I have add extern C to userspace library headers to be able to use the libraries in C++ code.
I have also add explicit cast to long int in msleep function since it generates a narrowing conversion error on my side.

Regards,
A. FLAISCHER (Accelize)

@kristopk kristopk requested a review from AWSrobertmj May 24, 2017 23:19
Copy link
Contributor

@AWSrobertmj AWSrobertmj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your cplusplus changes look good.

Based on this definition:
The <time.h> header declares the structure timespec, which has at least the following members:

time_t tv_sec seconds
long tv_nsec nanoseconds

Please try the following cast on your side for consistency with the definition (e.g. use time_t and long):
struct timespec sleep_time = {
.tv_sec = (time_t)(ms / MS_PER_SECOND),
.tv_nsec = (long)((ms % MS_PER_SECOND) * NS_PER_MS)
};

This compiles ok on my side w/o warnings.

@aflaischer
Copy link
Author

Work fine on my side, I update the cast

@AWSrobertmj AWSrobertmj merged commit 2d0c60e into aws:master May 30, 2017
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.

2 participants