From owner-freebsd-questions@FreeBSD.ORG Tue Jan 15 18:35:46 2013 Return-Path: Delivered-To: questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8ADDDE6B for ; Tue, 15 Jan 2013 18:35:46 +0000 (UTC) (envelope-from tomdean@speakeasy.org) Received: from asbnvacz-mailrelay01.megapath.net (asbnvacz-mailrelay01.megapath.net [207.145.128.243]) by mx1.freebsd.org (Postfix) with ESMTP id 566B8E2E for ; Tue, 15 Jan 2013 18:35:46 +0000 (UTC) Received: from mail5.sea5.speakeasy.net (mail5.sea5.speakeasy.net [69.17.117.49]) by asbnvacz-mailrelay01.megapath.net (Postfix) with ESMTP id BB9E4A71158 for ; Tue, 15 Jan 2013 13:35:45 -0500 (EST) Received: (qmail 10190 invoked from network); 15 Jan 2013 18:35:45 -0000 Received: by simscan 1.4.0 ppid: 31342, pid: 24638, t: 0.2908s scanners: clamav: 0.88.2/m:52/d:10739 spam: 3.0.4 Received: from unknown (HELO [192.168.2.7]) (tomdean@[24.113.104.91]) (envelope-sender ) by mail5.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 15 Jan 2013 18:35:45 -0000 Message-ID: <50F5A189.7000701@speakeasy.org> Date: Tue, 15 Jan 2013 10:35:53 -0800 From: "Thomas D. Dean" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: "questions@FreeBSD.org" Subject: time_t definition Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail5.sea5 X-Spam-Level: * X-Spam-Status: No, score=1.3 required=8.0 tests=RATWARE_GECKO_BUILD, TO_ADDRESS_EQ_REAL autolearn=disabled version=3.0.4 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2013 18:35:46 -0000 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_t */ #include /* 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