hoser@ucrmath.UCR.EDU (Mark Houser) (07/20/89)
Ok, first a few words. I fot the fix off of THE REEF BBS (the BBS for S*P*A*C*E; 1-206-848-3371; 3/12/2400; 24hr.) I was playing with Turbo BASIC XL earlier this evening, trying find an answer for the initial question of how to set TIME$ and ran into some difficulty. It seems that while this fix takes care of how Turbo BASIC keeps time, it doesn't seem to do anything for setting it (that or it breaks that part, I didn't check that out). Any way I did find a way to assign a value to TIME$ and have it retain the right value. To set TIME$ just assign a 6 char string to it. Exactly 6 characters. eg. TIME$ = "123456" - this "should" set the TIME to 12 hours 34 minutes 56 seconds. It doesn't. I don't know why, but with some experimentation came to the conclusion that the fix didn't bother to fix the routine which sets the time from the string. But there is a work-around (almost - I'll get to that In a minute). Convert the time to a number - t = 12 * 3600 + 34 * 60 + 56 for the example above - and multiply the result by 1.2 (round it if you want). Note: this is 6/5 - the ratio of American and European frequencies, although I'm not sure if there is a relationship or not. Now convert the new value (t * 1.2) back to a string and assign the string (6 characters, remember) to TIME$. This isn't nearly as bad as it sounds and can be done pretty easily (and cleanly) in Turbo BASIC with its DIV and MOD functions. The only problems I really had were converting a string to a number (I thought there was a function to do it, but couldn't find it and was too lazy to look it up). If you view TIME$ immediately after the assignment you'll get back the time you gave it! Maybe. This is where things get a little wierd. The value of TIME$ immediately after assignment was frequently off by several seconds (0-5 was observed), and, for the most part, the larger the time, the more the difference. At least TIME$="000000" works like it should. :-) Anyway, you might need to tweak the value assigned to TIME$ if you want it to be exact to the second, but once the value is in it will increment by seconds. Oh, also the string assigned to TIME$ must be a valid time; ie. "133517" is valid while "106500" isn't. I only worked with TIME$ and not with TIME, so I may be approaching everything wrong, but at least it almost worked completely right. Enough rambling - here's the fix. Have fun with it and the now available functions of Turbo BASIC XL. The code is in Turbo BASIC. The following is the uuencoded version of the saved program. Byte count: 1096 Checksum: #x0B4E ================== BEGIN ===== cut here ====================== begin 666 TBASFIX.TBS M 08!!P$G 24%.@5!I$*DR]@ @ " 0 " y M , # !T= %1U<F)O($)A<VEC(%1)344D(&9I>&5RFP0 9V< 5&AIy M<R!P<F]G<F%M('!E<FUA;F5N=&QY(&9I>&5S('EO=7(@;W)I9VEN86P@5"UBy M87-I8R!F:6QE('-O('1H92!424U%)"!C;VUM86YD('=I;&P@=V]R:R!P<F]Py M97)L>9L% !D9 &EN($%M97)I8V%N($%T87)I<RZ;!@ W-P!7<FET=&5N(&)Yy M.B!,=6ES($4N(%)O9')I9W5E>B!F<F]M($IU86YA($1I87HL(%!2FP< !@8 y MFP@ )B8 57!L;V%D960@=&\@1T5N:64@8GD@22Y23T1224=515J;"@!,&Q2 y M.PY" 8$$ L$H$[#D 5 "P4+#: -PY 0 L+@\! !0]-H W#D(!y M@00 "PN#P$ %$PV@#<.0 ( +"Z %A0 (" H#QA]5'5R8F\@0F%S:6,@y M5$E-120@9FEX97(6'@!)20(//QT=4&QE87-E(&5N=&5R(&9I;&4@;F%M92!Oy M9B!4=7)B;R!"87-I8R!F:6QE("A$;CIF:6QE;F%M92YE>'0I(!6!%B@ 1$ Hy M#S@=4&QE87-E(&EN<V5R="!Y;W5R(%1U<F)O($)A<VEC(&1I<VL@("!A;F0@y M<')E<W,@86YY(&ME>11$*8(6,@ J#0T.00& %"H7' Y 0 2#D $y M !(. $H$6/ ;&T,<#D ! !)#.H L$@Y" 8$$ 61@ .y M#A$<#D ! !90 !45-H,M6#J / \&0P0R +!9: #D/!X,B#@ y M !LV* \B'?U4=7)B;R!"87-I8R!F:6QE(&%L<F5A9'D@9FEX960N'10Y%19Dy M !T=-H W@SR#)0Y !0 L+@\&0P47<W5B%FX 144"#SL=16YT97(@;F%My M92!O9B!N97<@9FEL92 H3D5615(@;6]D:69Y("!Y;W5R(&]R:6=I;F%L(&1Iy M<VLI(!6!%G@ 0#PH#S0=4&QE87-E(&EN<V5R="!D97-T:6YA=&EO;B!D:7-Ky M(&%N9" @("!P<F5S<R!A;GD@:V5Y%$ I@A:" "H-#0Y! 9 4*A<<#D !y M !(.0 @ $@X 2@1:, !@80AP.0 $ $D,Z@"P20CJ y M+!:6 X.$1P.0 $ %J +BXH#R8=66]U<B!4=7)B;R!"87-I8R!F:6QEy M(&AA<R!B965N(&9I>&5D+A:J 8&%1:T !\5* \+'?U%4E)/4BT@(" 5;!0?y M"@Y , 6O@ ?%2@/"QW]15)23U(M(" @%6P4'PH.00$0 %@" %149y 0#PU$.E1"05-&25@N5$)3%@ y end ================== END ======= cut here ====================== Mark Houser Internet: hoser@ucrmath.ucr.edu