Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!uwvax!oddjob!gargoyle!ihnp4!alberta!james From: james@alberta.UUCP (James Borynec) Newsgroups: comp.os.minix Subject: IBM AT real time clock program Message-ID: <338@pembina.UUCP> Date: Wed, 13-May-87 15:25:39 EDT Article-I.D.: pembina.338 Posted: Wed May 13 15:25:39 1987 Date-Received: Sat, 16-May-87 07:26:35 EDT Organization: U. of Alberta, Edmonton, AB Lines: 50 /* due to popular demand, here is my AT real time clock reader */ /* it produces on standard output the numbers needed for the */ /* date -q command. */ /* port_in and port_out routines can be had from klib88.s */ /* james borynec james@alberta */ #define cl_out_port 0x70 #define cl_in_port 0x71 #define sec_addr 0 #define min_addr 2 #define hr_addr 4 #define date_addr 7 #define mon_addr 8 #define yr_addr 9 main () { int seconds,minutes,hours,date,month, year; port_out(cl_out_port,sec_addr); port_in(cl_in_port,&seconds); port_out(cl_out_port,min_addr); port_in(cl_in_port,&minutes); port_out(cl_out_port,hr_addr); port_in(cl_in_port,&hours); port_out(cl_out_port,date_addr); port_in(cl_in_port,&date); port_out(cl_out_port,mon_addr); port_in(cl_in_port,&month); port_out(cl_out_port,yr_addr); port_in(cl_in_port,&year); printf("%02d",(month/16)*10 + month%16); printf("%02d",(date/16)*10 + date%16); printf("%02d",(year/16)*10 + year%16); printf("%02d",(hours/16)*10 + hours%16); printf("%02d",(minutes/16)*10 + minutes%16); printf("%02d",(seconds/16)*10 + seconds%16); printf("\n"); }