[comp.os.minix] xtclock

wkt@csadfa.cs.adfa.oz.au (Warren Toomey) (01/09/90)

I wrote this about a year ago, and lost it a week after when my disk died :-(
This time I'm posting it before that happens :-)

Xtclock reads the time from PC cards that use TIMER.COM. I don't know
which ones they are, sorry. Also I don't know why I shar'd such a small file!

	Warren.

------------------------- dessicate here --------------------------------
echo x - xtclock.1
sed '/^X/s///' > xtclock.1 << '/'
X.T1 xtclock 1L
X.SH NAME
Xxtclock \- get current time from XTs hard clock
X.SH SYNTAX
Xxtclock
X.SH DESCRIPTION
X.I Xtclock
Xprints the time as kept by a clock card in some XTs. It is printed in the
Xsame form as
X.B date
Xneeds, so the following form of line may be placed in
X.B /etc/rc:
X.PP
X/usr/local/bin/xtclock | /usr/bin/date -q > /dev/null
X.SH BUGS
XIt is possible that the program will get the time or date wrong, as it
Xgets each field separately. However the chances of this are small.
X.SH SEE ALSO
Xdate(1).
/
echo x - xtclock.c
sed '/^X/s///' > xtclock.c << '/'
Xmain()
X {
X  int month,day,yr,hr,min,sec;
X
X   port_in(0x348,&yr);
X   port_in(0x347,&month);
X   port_in(0x346,&day);
X   port_in(0x344,&hr);
X   port_in(0x343,&min);
X   port_in(0x342,&sec);
X   printf("%02x%02x%02x%02x%02x%02x\n",month,day,yr,hr,min,sec);
X }
/
  Warren Toomey VK2XWT, heavily steaming Frenchman
     Deep in the bowels of ADFA Comp Science.
  Canberra. ACT. 2600.  Email: wkt@csadfa.oz.au 
    `Sex isn't everything. Love is. - WT'