Short: Set amiga clock from unix 'date' command (TERM)


SetClock.Rexx
-------------

About Midnight April 6, 1993

This is an AREXX script for TERM versions 2.4a and 3.1 (and probably others
but I have not tested for them).  It will query the host Unix system (that
you are all ready connected to) for the date and time and set your Amiga's
internal clock to that date.  I wrote this because the system I regularly
use has a very accurate clock (thanks to NNTP) and I was tired of dealing
with the time shift two times a year.  My eventual goal is to make this
fully automatic (dial, get the time, hangup) but I don't really need it
that sofisticated yet... and this was quick and easy to write (as compared
to that 16 page essay on relational databases that I have to pass in in
8 hours and have yet to start!  :-/ )

The execution of this script is pretty straight forward.  It sets the
timeout for one minute, then sends a string to cause the Unix system to
wait 10 seconds and then broadcast the date.  The 10 seconds is more than
enough time to allow the the REXX script to set up for the next step (in
fact its likely overkill... but what the hey...)  Then the script pauses
for 5 seconds to allow the echo of the above command to occur...  then
the script grabs the next 28 bytes (which should be the date string).
It then reformats this string and calls AmigaDOS to set the date (using
the DATE command).  The resulting date should be pretty close to the
one on the Unix side, the only loss occuring with the time it takes to
capture the date, reformat it and execute the DATE command.  Expect the
difference to be about 3 seconds or less... not really significant for my
purposes.

Theres no error checking in this script (there probably should be, and I
may add it later, at least to the 3.1 code once I have 3.1 (or better)
working satisfactorily on my machine.  I was not too worried for a couple
of reasons...  First, if the capture of the date is garbage, then the
call to the AmigaDOS DATE command should fail without changing the existing
system date and time.  And if something else should happen, and the date
does get changed, but is incorrect, then you can always just do a
SETCLOCK LOAD to fix it (assuming the save date was close to correct to
begin with.)  This is also a good time to *NOTE* that you must use
SETCLOCK SAVE to make any date change permanent (last after a reboot of the
machine.)

Enjoy,

Nickey MacDonald
i6t4@jupiter.sun.csd.unb.ca
