Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!xanth!nic.MR.NET!shamash!com50!pwcs!stag!daemon From: to_stdnet@stag.UUCP Newsgroups: comp.sys.atari.st Subject: Bug in ST clock setting Message-ID: <792@stag.UUCP> Date: 19 Apr 89 02:54:16 GMT Sender: daemon@stag.UUCP Lines: 301 From: dal@syntel.UUCP (Dale Schumacher) [close@cacilj.UUCP (Diane Barlow Close) writes...] > In article <3229@cs.dal.ca> silvert@cs.dal.ca (Bill Silvert) writes: >>- I asked about a bug I have run into, and they hadn't run into it -- >> have any of you? My date function doesn't work, it always generates a >> date on Jan. 1 some year in the 21st century (which year I forget). >> The guy I spoke for said it works for him. Perhaps it involves my >> clock-setting software -- I use the clock that comes with the Supra >> 60-Meg hard drive, which seems to work fine for everything else. >> Anyone have any idea what the problem might be? It would be a very >> useful function if I could get it to work! > > There are actually 3 clocks in the ST. They are the keyboard clock, the TOS > clock, and the BIOS clock. Some hard drives set only one clock. My BMS card > sets only the TOS clock. If I remember correctly, I think WP uses the BIOS > clock (a leftover from PC days, perhaps?). Since the BMS clock only sets the > TOS clock, my time and date in WP are screwed up (Jan 20 20??, way in the > future). I don't think there are really 3 clocks in the ST, only 2, but you're on the right track. The Supra SUPCLKRD program reads the clock in the disk drive and sets the GEMDOS time accordingly. The GEMDOS time (or system time) is reset on even a warm-boot and defaults to some time in 1985. This is the time used to time-stamp files when they are created and is the most often used time reference. The BIOS time (or keyboard time) is maintained by the processor in the keyboard and is independent of the system clock. It also retains it's time setting through a warm-boot, but not through a cold-boot. On cold-boot (power off), the keyboard clock defaults to the 20xx year value described above. > To fix this irritating problem, my husband wrote a small program in Mark > William's C that sets the BIOS clock. Since it's a small program, I'll > include it here: > > /* set all clocks according to TOS time */ > > #include > #include > > main() { > tetd_t td; > > td = ((long)Tgetdate()<<16) | (unsigned)Tgettime(); > Settime(td); > Ksettime(tetd_to_tm(td)); > } There are a number of MWC specific features here, like Ksettime() and tetd_to_tm(), so I'm not certain what this is really doing, but I assume that it "does the right thing" when compiled with MWC. From the operating system level there are a set of GEMDOS functions for reading/setting the system time, they are: #define Tgetdate() (int)gemdos(0x2A) #define Tsetdate(date) gemdos(0x2B,date) #define Tgettime() (int)gemdos(0x2C) #define Tsettime(time) gemdos(0x2D,time) ...and there are a couple of XBIOS functions for reading/setting the keyboard time, they are: #define Settime(time) xbios(22,time) #define Gettime() xbios(23) The parameters for these calls differ considerably, so you should look them up before trying to use these calls. I expect that the problems of the original poster were due to using the XBIOS calls and thus refering to the keyboard clock, which wasn't being set properly. ...AND NOW FOR SOMETHING COMPLETELY DIFFERENT... A BUG REPORT! There is a nasty bug that crops up when you are working with both clocks at the same time. If you read the system date and time, then read the keyboard time, and immediately set the system date and time, the KEYBOARD clock will stop counting and seems to set itself to an unusual value. If you read the keyboard clock first, then the system, and then set the system time, everything works just fine. Here is a program which handles all of these problems correctly, sets both clock, works nicely from the /AUTO/ folder and is fairly intelligent about determining good defaults for the time. table !"#$%&'()*+,-./0123456789:;<=>? @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ begin 644 date.arc M&@A$051%+E144 UB, ) 2%)*PAO,T ,8#0 -!"P4 #- ! &@!'z MH0,53U"\ 4!@!+.!,WR88 $ @356 !B,&(91R$8 $#X"H# 2HY&3&%1R: E@y MAA*:,YR,8 > 8TTI07@"@H !": ? %X@<))KH HL7!Z9R('1B8DA1 :I)&")x MUT ! $CP&>C"$PD%9P92("%!C5IJ@VAYI0B S4 $)'@,) " UJ V S6\T$M0w MP0^]"9P$B7KX7[;# )@HIK;(A1!*C%X(>,% R!G(2A1_XZ=P .F UDP^0&$v MHI)/D"4'&?$-HQ7%8 ;*H&W;29/< $SPKGG;"7 -(Z[9=N&(Q1,EIF"XZ"ABu MN@(G0EA\^96OJIO @P>V\ Y\>)'C?_%5OR"*G$G=5 #$*#E!1\R3-*(F0/"t M3@P7,@SDA!7_\./"7"UP$1X ,>@C'PC68/'(@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A5%8 0'_@9O0.)AX 9Y )A( =G4 =M4 9N0 =S8! AD@ AD@ *P0 !p MT%>0 $$ !9]!0D.0 #*S>0X $ !9@ 0D.0 "-TBB0(#>08 $(X +80 (o M( $(0 $J /TO! 8H 8@ 88 &\/H&\/H&P 2( 8^P (&T$X,X %"8 $@n MX 68 0X *,& 6( $XX FX HX LX TX 08 $.X :;P 28 (P *m M0 $.L#428 (P "SY@ R8 "VX !:0 $.L! >X *,*4*H !( ELI0$: $*l MP (*@ $60 ,0X "VP 9$P0(HP V4!;20 L:X (48 -$ 2E?! $D( ,(8 $2k MX ,J ,!H $.@ .X 0>X ?$20(H8 (DX%TB@ =80 (L$ .@ 9LX %.P $!j M@ W* $0@ (X 7%J $6( (*H >( $0(&DHH $<@ !LP *%1@ *H &8 ."i M@ 1B0 ,*( 'YKP XH TD"P*0 (&<(8&8 "$<(Y<( $8P "K2 ,0( 0&L(,2h M0 42H &8 ,P $(@ L40 $J( $08 $.P "2QBP(,'XT %*8 ,.P (>8 $:g MH $F $]R ,R 0>8 ,4X $^H !Z0 $*P 88 :8 H@ . (*0 &OCP (f M0 'C)P$*X .@ .0 $*P #T[ 08 4H/$:SP$. (&L! *0 (<@ 2 *.0e 9@ !,"L$ D-0 4$ D1@ ($ D2 : /$:d c end -- Dale Schumacher 399 Beacon Ave. (alias: Dalnefre') St. Paul, MN 55104 ...bungia!cctb!syntel!dal United States of America "I may be competitive, but I'm never ruthless"