From owner-freebsd-questions Mon May 18 17:36:53 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA23168 for freebsd-questions-outgoing; Mon, 18 May 1998 17:36:53 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from freebie.lemis.com (freebie.lemis.com [139.130.136.133]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA23049 for ; Mon, 18 May 1998 17:35:57 -0700 (PDT) (envelope-from grog@lemis.com) Received: (from grog@localhost) by freebie.lemis.com (8.8.8/8.8.7) id KAA13009; Tue, 19 May 1998 10:05:55 +0930 (CST) (envelope-from grog) Message-ID: <19980519100554.K427@freebie.lemis.com> Date: Tue, 19 May 1998 10:05:54 +0930 From: Greg Lehey To: questions@FreeBSD.ORG Subject: Re: Year 2038 or 2106? References: <19980518210524.A17078@ucb.crimea.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91.1i In-Reply-To: <19980518210524.A17078@ucb.crimea.ua>; from Ruslan Ermilov on Mon, May 18, 1998 at 09:05:24PM +0300 WWW-Home-Page: http://www.lemis.com/~grog Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, 18 May 1998 at 21:05:24 +0300, Ruslan Ermilov wrote: > On Mon, May 18, 1998 at 01:47:00PM -0400, Cliff Addy wrote: >> I'd always read that fbsd was good until at least 2038, as far as >> date/time computations, since the time is stored as a 32-bit integer of >> seconds since the Jan 1, 1970. >> >> Just on a whim, I decided to check this. I took 2^32/60/60/24/365 and >> added that to 1970. Now, I know I didn't account for leap years, but I >> still come out to the 2106, not 2038. I always assumed that an *unsigned* >> integer was used, if I use a signed integer I get 2^31/60/60/24/365 plus >> 1970 which *does* yield 2038. >> >> So, I guess my questions are: Is the date an unsigned or signed integer? >> If signed, why? If unsigned, why isn't the "date of death" 2106? Or did >> I just completely misunderstand or miscalculate? >> >> Too much time on my hands ... > > # cd /usr/include && grep _BSD_TIME_T_ */* > machine/ansi.h:#define _BSD_TIME_T_ long /* time() */ > sys/types.h:#ifdef _BSD_TIME_T_ > sys/types.h:typedef _BSD_TIME_T_ time_t; > sys/types.h:#undef _BSD_TIME_T_ In case this is too cryptic: time_t is a signed quantity. That means you only have 31 bits to play with. Greg -- See complete headers for address and phone numbers finger grog@lemis.com for PGP public key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message