From: utzoo!decvax!ittvax!tpdcvax!bobvan Newsgroups: net.unix-wizards Title: Time of year for kernel changes Article-I.D.: tpdcvax.190 Posted: Fri Oct 29 11:25:46 1982 Received: Sat Oct 30 02:37:13 1982 This is an appropriate time of year for me to confess to a rather questionable hack that I put into our Berkeley UNIX kernel some time ago. We must run VMS at least once per day, sometimes twice per day. Those of you who've done this know that the time of day has to be reset each time we change operating systems. It really is a pity too. Code in machdep.c goes to great lengths to keep the hardware clock register in the same form as VMS. However, UNIX uses GMT and VMS uses local time. We had to set the clock ahead or back 6 hours every time we changed operating systems. This lead to operating screw ups on at least two occasions. The clock would accidentally be set off by an hour or a day, and it was never possible to keep the clock set accurately. Being much more adept at changing UNIX than VMS, I slipped the appropriate +6 and -6 into the code in machdep.c and all has been fine until now. It is appropriate to tell you about this now because I have to change the 6's to 5's this weekend when we go from CDT to CST. The alternative is to put all of that ugly "is this the last Sunday of October" code from ctime.c into the kernel. Neither solution is very good (any better ideas?). Even if I get hit by a beer truck and the kernel never gets changed again, we can go back to resetting the clock twice per day if we have to. I've included diff's for others in the "two OS" boat with us. Only constructive flames, please. (look! An oxymoron! ^^^^^^^^^^^^^^^^^^^) Bob Van Valzah (...!decvax!ittvax!tpdcvax!bobvan) *** machdep.old.c Thu Sep 9 16:51:44 1982 --- machdep.c Thu Sep 9 17:08:27 1982 *************** *** 187,193 clkinit(base) time_t base; { ! register unsigned todr = mfpr(TODR); long deltat; int year = YRREF; --- 187,198 ----- clkinit(base) time_t base; { ! /* ! * RAV todr is kept fudged so date doesn't have to be set ! * when going to VMS. Change "timezone-60" to "timezone" ! * (both here and below) when we go off daylight savings time. ! */ ! register unsigned todr = mfpr(TODR)+(timezone-60)*60*100; long deltat; int year = YRREF; *************** *** 268,274 yrtime -= secyr; year++; } ! mtpr(TODR, TODRZERO + yrtime*100); } #ifdef PGINPROF --- 273,279 ----- yrtime -= secyr; year++; } ! mtpr(TODR, TODRZERO + yrtime*100 - (timezone-60)*60*100); } #ifdef PGINPROF