dc and date numerology

Warren Toomey wkt at cs.adfa.edu.au
Thu Oct 28 10:02:25 AEST 1999

In article by norman at nose.cita.utoronto.ca:
> Greg Lehey wondered about the date in
> > 	-r---wxrw- 0/0            6846 Apr 14 06:50 1973 bin/dc
> 1973 is indeed post-Second-Edition.  But it's not the right date; just as
> the permission flags were different in the early years, so was the date
> representation.  Here are some gleanings from old manuals that tell the
> story.

[ much omitted ]
Norman details the fact that early Unixes stored time in 60ths of a second,
i.e the normal clock tick, and as such, a 32-bit integer overflows in
around 2.5 years.

However, I think Norman is not exactly right when he said that the
tar archive was reinterpreting this 1/60 sec time in units of seconds.

Dennis Ritchie, with help from Keith Bostic and a DECtape drive, managed to
retrieve these files from an old DECtape. These old files were stored in
tap(1) archive format.

Dennis wrote a program to read in the tap(1) format archives and extract
their contents while trying to maintain the _correct_ permissions and
timestamps. Here is his email describing this:

	The tapes were written in either the 'tap' or 'tp' format, which
	are similar in that they have a directory of up to 192 entries at
	the start with names and other information including the size and
	tape address of the files.  'tp' was the later format, and was in
	use by November 1973, the date of the 4th edition manual.  With
	`tap', the times associated with the files were recorded in pre-modern
	units: sixtieths of a second, from an origin that changed.  The
	first three editions of the manual had BUGS sections noting that
	32 bits can represent only about 2.5 years in this unit, and this
	implied continuing crises as the time overflowed.

	I believe that the change to use seconds for Unix time took place
	along with the change to the C version of the operating system,
	which occurred about the end of the summer of 1973, and also that
	the change from `tap' to `tp' took place at the same time.  (This
	is consistent with the dates of the 3rd and 4th edition manuals).
	Thus the dates recorded with the `tp' tapes probably correspond
	reliably to the modification dates of the files at the time of
	saving them (of course, this gives only a upper bound on their
	creation, since they might have been copied or trivially touched
	just before saving them).
	Recovering the proper dates for the `tap' tapes is less reliable,
	because there was at least one change of epoch (from 1971 to 1972)
	during the period they could possibly have been produced.  I believe
	that the 1972 epoch is most likely the correct one for the tapes here.

In other words, Dennis had to guess the epoch when recovering these files.
He got it right with the `nsys' kernel files, because there is enough other
data lying around documenting the kernel rewrite from assembly to C, and
the inclusion of pipes into the kernel.

However, with the s2.tar archive, I think Dennis got the epoch one year out,
i.e everything should be dated a year earlier. The most obvious is that
there are so many 0405 magic a.out files in the archive, and apparently
this a.out format disappeared in the 2nd Edition.

Cheers all,

More information about the TUHS mailing list