This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
Subject: Re: Unix time WAS: Max Filesize in 2ext FS? From: "Michael H. Warfield" <mhw@wittsend.com> Date: Thu, 20 May 1999 18:09:00 -0400 (EDT) Rick Forrester enscribed thusly: > mhw@wittsend.com said: > > Ok... I though Linux was one of the "enlightened" versions of Unix. > > I guess I was wrong. But my point is that, if we are using a signed > > long (and not all flavors of Unix use a signed long - some use > > unsigned long and have for a long [excuse the pun] time [and that pun > > too]) then WHY? What does the sign get us? Even if some of the time > > function calls need to return a -1 for an error (which ones), this > > can be handled without tossing 68 years worth of range. > Someone on the list has already ventured the comment that it was done > to support the expression of dates prior to 1970. I must confess that > I really don't have a clue. Out of curiosity, I just checked what the > usage is in Sun/Solaris on my UltraSparc 1 here; it's also a signed long, > and limits.h shows the same upper limit. I'd be curious to know what > systems _don't_ use a signed long int as the base type for time_t. Not... It was originally done that way because we had no choice (I was one of those involved in the early stuff with XENIX, PDP-11, Masscomp, and all sorts of archaic stuff). Lot's of the early systems did not HAVE an unsigned long! To make matters worse, some of them didn't have an unsigned char or only had an unsigned char, but that was another problem entirely. Most of the compilers, prior to the advent of gcc, did not have an unsigned long. All you had to work with was signed longs. This has far worse implications than what you might imagine. In one of my more humorous diagnostic adventures at a company I was at 15 years ago, our MIS department was telling me that connections to their mainframe (a Harris HCX-9) from an Annex terminal server would sporadically fall over and fail as soon as the connection was made. Just about half of the connections would fail like this. Now, I had already seen this effect a year or more previously in developing a TCP stack for a proprietary system, so I took a good guess. I told them to put a sniffer on the line and to check out the initial sequence numbers on the SYN packets. My guess was that the HCX-9 was a formal BSD stack with time based sequence numbers and the Annex terminal server was more RFC compliant and providing random initial sequence numbers. The failed connections would be those where the Annex terminal server provided an initial sequence number with the high order bit set. The HCX-9, being a BSD based implementation, would interpret this as a negative number and be all hosed up. 48 hours later, a very VERY scared MIS technician wanted to know how I figured all of that out seeing as I had never even set foot in their building. To this day, they fear me... :-) I don't have a list of systems that use an unsigned long (I use to, a long [damn, another pun] time ago). I can confirm that SCO Unix is definitely signed (I just checked - and I thought it was one of the ones that was unsigned). I'll check my AIX (3 & 4) and HP/UX (9 & 10) as well as my *BSD and Irix boxes and see if I can accumulate a survey. I had never heard the comment about times prior to 1970 until you just mentioned it. :-) > best