Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sdd.hp.com!mips!daver!bungi.com!news From: culberts@hplwbc.hpl.hp.com (Bruce Culbertson) Newsgroups: comp.sys.nsc.32k Subject: Re: /dev/rtc Message-ID: <9009131644.AA22494@hplwbc.hpl.hp.com> Date: 13 Sep 90 16:44:43 GMT Sender: news@daver.bungi.com Lines: 37 Approved: news@daver.bungi.com > Karl Swartz writes: > > Johan Myreen writes: > > > I myself have written something that also might interest you out > > there: a driver for the real time clock. You talk to it through the > > special file /dev/rtc > > That would be very nice indeed. If I can ever manage to get the > sources I'll enhance the date command to use this. What will your > driver do if there's no clock installed? It would be nice to have > some automagic way of detecting that so you wouldn't have to diddle > with a kernel option to use the thing. What about putting something like this in /etc/rc: # set system date if (test -c /dev/rtc) then # read date from hardware real time clock date_formatter < /dev/rtc | date -q else # prompt user for date date -q fi Date_formatter (to be written, but trivial) converts the eight bytes from the real time clock chip into the mmddyyhhmmss format which the date command likes. The date command would be unchanged. Also, we would remove the RTC code which I supplied from the kernel. If you have an RTC, you mknod /etc/rtc; if not, you do not mknod /dev/rtc. The kernel would have a new device driver but otherwise would not know about the RTC. I think this is clean -- what do you think? Bruce