From owner-freebsd-questions Mon May 18 13:14:32 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA20830 for freebsd-questions-outgoing; Mon, 18 May 1998 13:14:32 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from alpha.xerox.com (firewall-user@alpha.Xerox.COM [13.1.64.93]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id NAA20739 for ; Mon, 18 May 1998 13:14:10 -0700 (PDT) (envelope-from leisner@sdsp.mc.xerox.com) Received: from gemini.sdsp.mc.xerox.com ([13.231.132.20]) by alpha.xerox.com with SMTP id <51949(4)>; Mon, 18 May 1998 13:13:38 PDT Received: from gnu.sdsp.mc.xerox.com (gnu [13.231.133.90]) by gemini.sdsp.mc.xerox.com (8.8.7/8.8.7) with SMTP id QAA12969; Mon, 18 May 1998 16:12:32 -0400 (EDT) Received: from gnu (localhost) by gnu.sdsp.mc.xerox.com (4.1/client-1.3) id AA12715; Mon, 18 May 98 16:12:31 EDT Message-Id: <9805182012.AA12715@gnu.sdsp.mc.xerox.com> To: Cliff Addy Cc: questions@FreeBSD.ORG Subject: Re: Year 2038 or 2106? In-Reply-To: Your message of "Mon, 18 May 1998 10:47:00 PDT." Date: Mon, 18 May 1998 13:12:31 PDT From: "Marty Leisner" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message , y ou write: >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 ... > >Cliff > > Probably because -1 is an error value: >From glibc: - Function: time_t time (time_t *RESULT) The `time' function returns the current time as a value of type `time_t'. If the argument RESULT is not a null pointer, the time value is also stored in `*RESULT'. If the calendar time is not available, the value `(time_t)(-1)' is returned. - Data Type: time_t This is the data type used to represent calendar time. In the GNU C library and other POSIX-compliant implementations, `time_t' is equivalent to `long int'. When interpreted as an absolute time value, it represents the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time. (This date is sometimes referred to as the "epoch".) In other systems, `time_t' might be either an integer or floating-point type. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message