[net.bugs.4bsd] Ctime

jeff@voder.UUCP (Jeff Gilliam) (08/04/84)

Index:	lib/libc/gen/ctime.c 4.2BSD Fix

Description:
	The ctime(3) function is broken in the 4.2 BSD release.
	Sometime after the 4.1 release someone changed all the 'long'
	variables in ctime.c to 'unsigned long'.  This is *wrong*.
	At the UNIX epoch (Jan 1 00:00:00 1970 GMT) local time is
	*negative*.

Repeat-By:
	Mount a level 0 dump tape.  Type 'restore t'.  If your system
	has the bug you will see output similar to:

		Dump   date: Fri Aug  3 13:23:12 1984
		Dumped from: Sat Feb  5 22:28:16 206	<<< ???
			.
			.
			.
Fix:
	To correct, simply edit ctime.c and change every 'unsigned
	long' to 'long', recompile, and add the corrected binary to
	libc.a.  Don't forget to do a ranlib on libc.a afterward.
	Finally, recompile restore and install.

	(As an aside, assuming longs are 32 bits, the return to
	signed numbers still allows keeping time correctly until
	2038.)

-- 
Jeff Gilliam	{ucbvax,ihnp4!nsc}!voder!jeff

dt@ist.UUCP (David Tilbrook) (02/08/85)

In the comment for sunday()

	"The value is the day number of the first Sunday
	on or after the day."

Not so ...
	s/first/last/
	s/after/before/

This bug, while not crucial, exists in V6, V7, PWB, 4.1BSD, 4.2BSD,
SysIII vax, SysIII pdp, SysV, and the BRL SysV/4.2 package.

/* <-- indicates when reading skip to --> */
-- 
David Tilbrook		{inset, root44, mcvax, qtlon}!ist!dt
Imperial Software Technology, London England