🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.games.emp
Article #42

Re: teklabs.1197: Watch out for date set wrong!!!!!

#42
From: utzoodecvaxduketrt
Date: Mon, 31 May 1982 17:55
34 lines
1417 bytes
A number of UNIX programs depend on the correct date,
and they can defend against incorrect dates only in limited ways.

It would help if date(I) defended against incorrect date changes.
Here is a quick hack that is in Duke's date.c:
45,50d44
< #define	FUTSLOP	(3600*2)	/* 2 hours in the future */
< #define	AGOSLOP	60		/* 1 minute in the past */
< #define	DAY	86400L		/* seconds in a day */
< #define	HOUR	3600		/* seconds in an hour */
< 	register time_t t;
< 	register char *ttense, *tunit;
73,91d66
< 		/* Check for implausible date change */
< 		t = timbuf - wtmp[0].ut_time;
< 		if (t > FUTSLOP || -t > AGOSLOP) {
< 			ttense = "later";
< 			if (t < 0) {
< 				ttense = "earlier";
< 				t = -t;
< 			}
< 			tunit = "second";
< 			if (t >= DAY) {
< 				tunit = "day";
< 				t = (t + DAY/4)/DAY;
< 			} else if (t >= HOUR) {
< 				tunit = "hour";
< 				t = (t + HOUR/4)/HOUR;
< 			}
< 			fprintf(stderr, "(That is %ld %s%s %s than the estimated date!!)\n",
< 				(long)t, tunit, t>1? "s": "", ttense);
< 		}
	Tom Truscott (duke!trt)
Technical Details
Message-ID: <bnews.duke.2187>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
From: utzoo!decvax!duke!trt
Newsgroups: net.games.emp
Title: Re: teklabs.1197: Watch out for date set wrong!!!!!
Article-I.D.: duke.2187
Posted: Mon May 31 17:55:51 1982
Received: Tue Jun  1 00:44:37 1982
Subject: Re: teklabs.1197: Watch out for date set wrong!!!!!
Date: Mon, 31 May 1982 17:55:51 +0000
Message-ID: <bnews.duke.2187>