From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 7 00:39:59 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5D3BF16A41F for ; Fri, 7 Oct 2005 00:39:59 +0000 (GMT) (envelope-from andreas.kohn@gmx.net) Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 610AB43D49 for ; Fri, 7 Oct 2005 00:39:58 +0000 (GMT) (envelope-from andreas.kohn@gmx.net) Received: (qmail invoked by alias); 07 Oct 2005 00:22:28 -0000 Received: from unknown (EHLO klamath) [212.204.44.203] by mail.gmx.net (mp025) with SMTP; 07 Oct 2005 02:22:28 +0200 X-Authenticated: #2431876 From: Andreas Kohn To: freebsd-hackers@freebsd.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-3he53P5qSvLO5wnKfh2e" Date: Fri, 07 Oct 2005 02:22:22 +0200 Message-Id: <1128644542.1273.36.camel@klamath.syndrom23.de> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 FreeBSD GNOME Team Port X-Y-GMX-Trusted: 0 Subject: struct timeval: why is tv_sec long? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2005 00:39:59 -0000 --=-3he53P5qSvLO5wnKfh2e Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, is there any special reason for timeval.tv_sec being long? --- sys/_timeval.h /* * Structure returned by gettimeofday(2) system call, and used in other calls. */ struct timeval { long tv_sec; /* seconds (XXX should be time_t) */ suseconds_t tv_usec; /* and microseconds */ }; --- I just stumbled across this code in an application, --- timeval tv; gettimeofday(&tv, 0); char tbuf[64]; struct tm tmp; strftime(tbuf, sizeof(tbuf), "%b %d %H:%M:%S", localtime_r(&tv.tv_sec, &tmp)); --- and this fails to compile on FreeBSD. I fixed the application code now, but I do wonder why that XXX in sys/_timeval.h is there. _timeval.h came into existence on 31-Dec-2002, before that timeval was defined in sys/time.h with both tv_sec and tv_usec as long. Could anyone offer any pointers? Best regards, -- Andreas --=20 was macht man eigentlich auf einer linux-gamer lan ? hl server aufsetzen und freuen ? *duck* ^^ --=20 was macht man eigentlich auf einer linux-gamer lan ? hl server aufsetzen und freuen ? *duck* ^^ --=-3he53P5qSvLO5wnKfh2e Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQBDRb++Yucd7Ow1ygwRAuV/AJ9zBOASQm/C+RMPwz3OBMI82fDd5gCeLRy6 1jw5tBD8QWIj4Qdk7eyeWT0= =SPNj -----END PGP SIGNATURE----- --=-3he53P5qSvLO5wnKfh2e--