upm_utilities: Add a _POSIX_C_SOURCE define if needed

In certain systems, where -std=c11 is used, certain posix extensions
are disabled unless specifically enabled.  On these systems, this
could cause usleep() and/or nanosleep() to fail with an implicit
declaration warning.  This patch ensures that at least POSIX 200809 is
used, if otherwise undefined.

This should fix Issue #513.

Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
Jon Trulson 2017-02-02 13:54:20 -07:00
parent 90d856d128
commit fb88fda5cb

View File

@ -23,6 +23,10 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _POSIX_C_SOURCE
// We need at least 199309L for nanosleep()
# define _POSIX_C_SOURCE 200809L
#endif
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#include <upm_platform.h> #include <upm_platform.h>