diff options
author | Mike Frysinger <vapier@gentoo.org> | 2012-05-21 16:55:56 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2012-05-21 17:03:10 -0400 |
commit | 592e27c3c41641d5d6c906e1b6cbc21b9ead4082 (patch) | |
tree | a4fa0669dc9d8b1b348ad0cc21ffc76535cb1f4c /gpsutils.c | |
parent | d5fc020a1cd98bc3fa45d82d8267150edee7624f (diff) | |
download | gpsd-592e27c3c41641d5d6c906e1b6cbc21b9ead4082.tar.gz |
fix building with clock_gettime and newer glibc
Building with recent glibc versions fails in gpsutils.c due to missing
definitions related to clock_gettime. This is because we define the
_XOPEN_SOURCE macro, but not to a new enough value. So set it to a
recent spec value that satisfies both strptime and clock_gettime.
Example build failure with glibc-2.15:
gpsutils.c: In function 'timestamp':
gpsutils.c:299:22: error: storage size of 'ts' isn't known
gpsutils.c:300:14: warning: implicit declaration of function 'clock_gettime' [-Wimplicit-function-declaration]
gpsutils.c:300:34: error: 'CLOCK_REALTIME' undeclared (first use in this function)
gpsutils.c:300:34: note: each undeclared identifier is reported only once for each function it appears in
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Diffstat (limited to 'gpsutils.c')
-rw-r--r-- | gpsutils.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -5,8 +5,10 @@ */ /* The strptime prototype is not provided unless explicitly requested. - * So add the define that POSIX says to to avoid: */ -#define _XOPEN_SOURCE + * We also need to set the value high enough to signal inclusion of + * newer features (like clock_gettime). See the POSIX spec for more info: + * http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02_01_02 */ +#define _XOPEN_SOURCE 600 #include <stdio.h> #include <time.h> |