Date: Fri, 07 Oct 2005 02:22:22 +0200 From: Andreas Kohn <andreas.kohn@gmx.net> To: freebsd-hackers@freebsd.org Subject: struct timeval: why is tv_sec long? Message-ID: <1128644542.1273.36.camel@klamath.syndrom23.de>
next in thread | raw e-mail | index | archive | help
--=-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 <TalisA> was macht man eigentlich auf einer linux-gamer lan ? hl server aufsetzen und freuen ? *duck* ^^ --=20 <TalisA> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1128644542.1273.36.camel>