FIX for kernal's native time-zone

Mike Levin mml at magnus.UUCP
Sun Apr 30 08:27:08 AEST 1989


All the recent postings about the kernal's time zone (which I hacked around
over a year ago for things like uucico by running a program which exported
the TZ into the environment first) made me decide to go poking around in
the kernal and see if I could find the time-zone info.  I couldn't, but
then it dawned on me that it probably wasn't _in_ the kernal, but rather
in the shared libs.  So I went looking.  If you do an hd (that's a hex
dump, which you accomplish by first linking /bin/od to /bin/hd) of the
/lib/shlib, you find the following lines:

*
00000400: 00 00 46 50  00 30 00 0c  00 30 00 10  45 53 54 00   ..FP.0...0..EST.
00000410: 45 44 54 00  00 00 00 00  00 00 00 00  00 00 00 00   EDT.............

	The EST.EDT part is obvious.  So, I fixed that by changing it to
PST.PDT.  That fixes the displayed time-zone, but NOT the offset from GMT.
Hmmm, that's curious.  So next, I started looking for something that would
represent the native EST's 5 hour offset from GMT, and figured that it
should be nearby.  I had _almost_ given up when I remembered that the
UN*X system represents time in seconds.  So, I got out my trusty hex
calculator, and I multiplyed 5(hours) X 60(minutes) X 60(seconds/min), and
I arrived at HEX 4650.  WOW- that value _IS_ in the very same line that
the other time-zone info is in! !  I recalculated the value for my
time-zone (HEX 7080), and replaced the 4650 with it.  I then did a 
shutdown, rebooted, and PRESTO.  Now my kernal is a NATIVE Californian.
No more need for anything funny, the TZ variable being unset simply
causes MY kernal to use local (California, that is) time.

	The way I went about making the changes is a BIT in-elegant.  I
hacked the dst fix program posted by Lenny Tropiano to locate and replace
these bytes in shlib.  Not very elegant, so that's why I haven't bothered
to post it here.  IF somebody knows a better way to do this, let me know.
If there _is_ no simple solution, and there's interest out there, and
with Lenny's permission, I can post what I have.  NOTE- I'm running with
3.51.  If you are running a different rev, and you do the hd, and you find
that things are different, any info would be appreciated.  I don't want to
say that this will work the very same way unless I'm sure.


				Mike Levin

-- 
 _            _           
| | ___  ___ |_| ___   Michael Levin     SilentRadio Headquarters- Los Angeles
| |/ ._\| | || ||   \  20732 Lassen Street,    Chatsworth  CA  91311    U.S.A.
|_|\___/ \_/ |_||_|_|  {pacbell|pyramid|csun}!srhqla!levin - levin at magnus.UUCP



More information about the Unix-pc.general mailing list