From owner-freebsd-questions@FreeBSD.ORG Thu Jan 17 00:17:21 2013 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 367098F4 for ; Thu, 17 Jan 2013 00:17:21 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id F2DBEA13 for ; Thu, 17 Jan 2013 00:17:20 +0000 (UTC) Received: from r56.edvax.de (port-92-195-45-17.dynamic.qsc.de [92.195.45.17]) by mx01.qsc.de (Postfix) with ESMTP id 4C56A3DC2C; Thu, 17 Jan 2013 01:17:19 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id r0H0HLme001929; Thu, 17 Jan 2013 01:17:21 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Thu, 17 Jan 2013 01:17:21 +0100 From: Polytropon To: Michael Sierchio Subject: Re: time_t definition Message-Id: <20130117011721.69799ef6.freebsd@edvax.de> In-Reply-To: References: <50F5A189.7000701@speakeasy.org> <20130116120015.3b8d0db4@mr129166> <50F6EDFB.70501@speakeasy.org> Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "Thomas D. Dean" , "questions@FreeBSD.org" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2013 00:17:21 -0000 On Wed, 16 Jan 2013 10:21:03 -0800, Michael Sierchio wrote: > Top posting for brevity - the fact is, the code in your original > example is wrong. There are reasons to complain about argument size > mismatches, esp. in print functions that call (versions of) malloc. > You should cast the time_t value explicitly, or use %d instead of %ld. This advice looks correct. If you use the source Luke, you'll find the following (taken from a 8.2-STABLE/i386 system source tree): /usr/src/sys/sys/types.h (line 253): typedef __time_t time_t; /usr/src/sys/i386/include/_types.h (line 97): typedef __int32_t __time_t; /usr/src/sys/i386/include/_types.h (line 55): typedef int __int32_t; So it boils down to (int), but %ld expects (long). This is the exact content of the warning. You can either case the (time_t) value to (long), or change %ld to %d to avoid the warning. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...