Date: Tue, 15 Jan 2013 10:35:53 -0800 From: "Thomas D. Dean" <tomdean@speakeasy.org> To: "questions@FreeBSD.org" <questions@FreeBSD.org> Subject: time_t definition Message-ID: <50F5A189.7000701@speakeasy.org>
next in thread | raw e-mail | index | archive | help
I am attempting to recompile some code from an older version. > uname -a FreeBSD ZD7000 9.1-STABLE FreeBSD 9.1-STABLE #1: Sun Jan 13 23:44:33 PST 2013 root@ZD7000:/usr/obj/usr/src/sys/GENERIC i386 > make gcc47 -O2 -pipe -I../../include -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -c data-collection.c data-collection.c: In function 'main': data-collection.c:214:4: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'time_t' [-Werror=format] data-collection.c:234:4: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'time_t' [-Werror=format] cc1: all warnings being treated as errors *** [data-collection.o] Error code 1 > cat data-collection.c ... #include <time.h> /* time_t */ #include <sys/time.h> /* gettimeofday() */ ... gettimeofday(&spi_stop, &tz); / * line 211 */ printf("Loop %d, SPI %ld %ld\n", loop, spi_stop.tv_sec, spi_stop.tv_usec); ... gettimeofday(&disk_stop, &tz); /* line 231 */ printf("Loop %d, Disk %ld %ld\n", loop, disk_stop.tv_sec, disk_stop.tv_usec); ... time.h defines time_t #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif sys/time.h includes sys/types.h which includes sys/_types.h which includes machine/_types.h where __time_t is defined typedef __int32_t __time_t; /* time()... */ Question: Why do I see the error? Tom Dean
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50F5A189.7000701>