home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / info / dateroll.fix < prev    next >
Internet Message Format  |  1994-03-07  |  11KB

  1. Path: rutgers!ucla-cs!wales
  2. From: wales@valeria.cs.ucla.edu (Rich Wales)
  3. Newsgroups: comp.sys.ibm.pc
  4. Subject: Re: Looking for TSR to fix date (LONG)
  5. Date: 15 Sep 88 19:59:03 GMT
  6. Reply-To: wales@CS.UCLA.EDU (Rich Wales)
  7.  
  8. In article <350@octopus.UUCP> pete@octopus.UUCP (Pete Holzmann) asks
  9. about the "date rollover" problem on a PC running DOS 3.3 (i.e., the
  10. date doesn't get advanced at midnight).
  11.  
  12. I believe this problem is due to a combination of DOS and the system's
  13. ROM BIOS.  My system, for instance -- an XT clone with the Award BIOS
  14. (Version "XT 2.03") -- exhibited this particular problem with MS-DOS
  15. 3.2 -- but *not* with MS-DOS 3.1 or 3.3.
  16.  
  17. I'm enclosing below a few messages which were sent out a while back
  18. about this problem.  Use this material at your own risk, of course.
  19.  
  20. Actually, there are *TWO* related problems known with regard to the
  21. proper advancing of the date.  One is the problem you mentioned (i.e.,
  22. the date doesn't change at midnight).  The other problem (obviously
  23. seen only by people who don't have the first problem, or have it only
  24. intermittently) is that if the system is left continuously idle over
  25. two or more consecutive midnights, the date gets advanced by only one
  26. day.  This latter problem has to do with the fact that DOS records the
  27. passage of a new day by *setting* (*not* incrementing) a flag that is
  28. supposed to get noticed the next time the system does something.
  29.  
  30. ========================================================================
  31.  
  32. From: rde@ukc.ac.uk (R.D.Eager)
  33. Subject: Re: Date not advancing at midnight on my clone
  34. Message-ID: <2666@eagle.ukc.ac.uk>
  35. Date: 8 Mar 87 17:43:17 GMT
  36. Organization: U of Kent at Canterbury, Canterbury, UK
  37.  
  38. I  had this problem on MS-DOS 2.11 on a British PC clone. I also managed
  39. to fix it, but the nature of the fix means that it works  ONLY  for  one
  40. version (and OEM implementation) of DOS.
  41.  
  42. The  BIOS  time  of  day  call  (INT  1AH)  is  what DOS uses to get the
  43. time. This is used by the DOS kernel only to get the  time  of  day. The
  44. call returns the time in CX/DX, and a flag (indicating date rollover) in
  45. AX. This flag is nonzero if the day has rolled over since the last call,
  46. and by definition is returned ONCE ONLY after a given midnight.
  47.  
  48. Now,  the  real problem is that the OEM portion of DOS may also call the
  49. INT 1AH function, and many implementations do this to provide a  timeout
  50. on  disk access in order to make up for the lack of door latch status on
  51. IBM style floppy drives. The details don't matter, but a call  from  one
  52. of  these  just  after midnight clears the rollover flag so that the DOS
  53. kernel never sees it.
  54.  
  55. My solution was messy (and doesn't handle the case of  an  idle  machine
  56. being left for a weekend), but it does work.
  57.  
  58. First,  scan  thru the DOS file IO.SYS or IBMBIO.COM, looking to INT 1AH
  59. calls.   Find  the  one  that  seems  to  do  something   with   AX   on
  60. return. Figure out from this code (easier than it sounds) the word where
  61. DOS obviously keeps the day number.
  62.  
  63. Second,  write  a little intercept (TSR) routine for INT 1AH. Do nothing
  64. on the way in, but on the way out check AX. If it is nonzero,  clear  it
  65. and increment the DOS day number yourself.
  66.  
  67. This WORKS. But, you need a different version for different versions and
  68. flavours  of  DOS  (because  the  day  number  isn't  always in the same
  69. place). It's a good idea to put some checks in to stop it being used  on
  70. the wrong version and zapping some other word.
  71. -- 
  72.            Bob Eager
  73.  
  74.            rde@ukc.UUCP
  75.            rde@ukc
  76.            ...!mcvax!ukc!rde
  77.  
  78.            Phone: +44 227 66822 ext 7589
  79.  
  80. ========================================================================
  81.  
  82. From: jsa@kolvi.UUCP (Jari Salminen)
  83. Subject: DOS 3.20 bug
  84. Message-ID: <1139@kolvi.UUCP>
  85. Date: 25 Mar 87 15:36:21 GMT
  86. Organization: Helsinki University of Technology, Finland
  87.  
  88. I noticed a really silly bug in MS-DOS 3.20 (maybe in PC-DOS 3.2 too).
  89.  
  90. DOS doesn't change date after midnight !!!!!!!!
  91. -----------------------------------------------
  92.  
  93. And this is why:
  94.  
  95. Code to read time (in DOS CLOCK$ device driver in IO.SYS)
  96.     XOR AH,AH        ; read Time-of-day from BIOS
  97.     INT 1Ah
  98.     MOV BX,DX        ; Note! Timer-overflow-flag in AL is LOST !
  99.     MOV AX,CX
  100.         ... some code to calculate time
  101.     MOV AX,CS:[0E53]    ; read OLD DATE !
  102.     STOSW            ; and store date to buffer
  103.  
  104. However, few bytes later in drive device driver in the same IO.SYS
  105. is the correct version to handle the same interrupt:
  106.  
  107.     XOR AH,AH
  108.     INT 1Ah
  109.     OR AL,AL        ; check if timer overflow has occurred
  110.     JZ over            ; if not, skip date updating
  111.     INC WORD PTR CS:[0E53]    ; Update date
  112. over:    ...
  113.  
  114. So, if the first command you're giving just after midnight has something
  115. to do with time ('dir', file saving etc.), the date update is lost.
  116. BUT, if you change drive or give command like 'dir a:' when A: is empty,
  117. the date is updated correctly !!!!!
  118.  
  119. That bug was NOT in DOS 3.1, so it seems that Microsoft has done
  120. a good job bugging DOS 3.2 (remember all those other bugs in 3.2 :-).
  121.  
  122. While waiting update, we should
  123.  
  124.     a) never work "Round Midnight" :-)
  125.  
  126.     b) reboot our systems at midnight (cause this bug in DOS does
  127.        not affect to real time clocks)
  128.  
  129.     c) write a new clock device driver for DOS 3.2
  130.  
  131. I think I'll choose c) !
  132.  
  133.                     Jari
  134.  
  135. -- 
  136. Jari Salminen                          !   UUCP:  jsa@kolvi.UUCP
  137. Helsinki University of Technology      !
  138. Otakaari 5 A                           !
  139. SF-02150 Espoo,  Finland               !   tel:   +358 0 4512918
  140.  
  141. ========================================================================
  142.  
  143. From: manes@dasys1.UUCP (Steve Manes)
  144. Subject: Re: Standard date bug
  145. Summary: The BIOS Timer Bug
  146. Message-ID: <2049@dasys1.UUCP>
  147. Date: 23 Nov 87 08:04:06 GMT
  148. Organization: The Big Electric Cat, NYC, NY
  149.  
  150. In article <7457@eddie.MIT.EDU>, nathan@eddie.MIT.EDU (Nathan Glasser) writes:
  151. > This is a question about the standard bug that many people know
  152. > about regarding the date maintained in memory on standard
  153. > pc's and many clones. If your computer is on when midnight comes
  154. > around, the date will not be changed. I don't know whether this
  155. > always happens or only sometimes.
  156. > Does anybody have any simple solution that they've been using?
  157.  
  158. Yes, although I believe that DOS 3.2 fixed this problem (I could be
  159. wrong; I still use 3.1).  The problem lies in a "sticky flag" maintained
  160. by the BIOS timer in the ROM_BIOS_DATA segment.  The structure of this
  161. segment is:
  162.  
  163.     ROM_BIOS_DATA SEGMENT @40h
  164.         org 6Ch
  165.     timer_low    dw ?    ; count up to 65535...(18.2x/sec)
  166.     timer_hi    dw ?    ; then increment this (every hour) until...
  167.     timer_ofl    db ?    ; we hit midnight and we inc' this.
  168.     ROM_BIOS_DATA ENDS
  169.  
  170. Whenever DOS calls BIOS to read the current real-time clock, it runs
  171. Interrupt 1Ah (see Tech Ref) and a single line of code that is executed
  172. during any TIME_OF-DAY "read time" call:
  173.  
  174.     mov    timer_ofl,0    ; get overflow and reset flag
  175.  
  176. In other words, every time Int 1Ah is called to read the time, whether from
  177. the DOS TIME/DATE routines or from your own homebrew to count the number of
  178. timer ticks, 'timer_ofl' is reset to zero and its previous contents
  179. returned in AL by Int 1Ah.  The sticky widget: DOS needs this flag so it
  180. knows that the date has rolled over.  If your application calls Int 1Ah
  181. before DOS gets it (and remember that this flag is set only ONCE every 24
  182. hours and read only ONCE and then reset) DOS will simply roll the clock
  183. over but not the day.
  184.  
  185. There are a few fixes that come to mind but the easiest by far is to write
  186. your own Int 1Ah replacement that DOESN'T reset 'timer_ofl'.  Fortunately,
  187. this is an easy task since Int 1Ah doesn't do very much.  What I do is use
  188. this routine whenever I need to read the timer block:
  189.  
  190.     push    es
  191.     mov    ax,40h
  192.     mov    es,ax
  193.     mov    ax,word ptr es:[6Ch]
  194.     mov    my_timerlo,ax
  195.     mov    ax,word ptr es:[6Eh]
  196.     mov    my_timerhi,ax
  197.     pop    es
  198.  
  199. That eliminates the problem.
  200.  
  201. -- 
  202. +-----------------------------------------------------------------------
  203. + Steve Manes         Roxy Recorders, Inc.                 NYC
  204. + decvax!philabs!cmcl2!hombre!magpie!manes       Magpie BBS: 212-420-0527
  205. + uunet!iuvax!bsu-cs!zoo-hq!magpie!manes              300/1200/2400
  206.  
  207. ========================================================================
  208.  
  209. From: dons@killer.UUCP (Don Simoneaux)
  210. Subject: Re: Standard date bug
  211. Summary: fix for date bug
  212. Message-ID: <2269@killer.UUCP>
  213. Date: 1 Dec 87 04:49:50 GMT
  214. Organization: The Unix(R) Connection, Dallas, Texas
  215.  
  216. In article <436@silver.bacs.indiana.edu>, creps@silver.bacs.indiana.edu (Steve Creps) writes:
  217. > In article <598@bucket.UUCP> leonard@bucket.UUCP (Leonard Erickson) writes:
  218. > >The bug *always* occurs. There's a discussion of it in Norton's Programmers
  219. > >Guide to the PC.
  220. >    I saw Norton's comment, and it says DOS 2.00 didn't consistently update
  221. > the date on the midnight signal, but that 2.10 and all other versions do.
  222. > I could still swear that it still happens in 3.2, but I haven't done any
  223. > scientific checks on this.
  224.  
  225. I ran MS-DOS 2.11 on my PC compatible for two years without seeing this
  226. problem.  When I upgraded to 3.2 about a year ago to make better use of my 
  227. new 30 MB hard disk, it appeared.  I had seen this a long time ago
  228. on a Wang PC, probably running 2.0.  From what I have read, MS fixed this
  229. in going from 2.0 to 2.1 but it mysteriously reappeared in later versions.
  230. They probably fixed it again in 3.21 (I hope).  I have seen a technical
  231. explanation which I am unable to repeat, but I found the following file on
  232. a bulletin board earlier this year.  Put this file (CLOCKFIX.SYS) in the
  233. root directory and put the line "DEVICE = CLOCKFIX.SYS" in your CONFIG.SYS
  234. file.  I believe this patches the timer tick interrupt vector to properly
  235. handle the midnight flag.  I have been using this since early this year
  236. and have had no problems.  UUENCODED file follows:
  237.  
  238.  
  239. begin 644 clockfix.sys
  240. M_____PB ,@ ] $-,3T-+)" @           ^ 6L :P!K .  9@!P '  A "$
  241. M '  <  NB1X2 "Z,!A0 R_Q04U%25E=5'@8NQ1X2 (I' CP+=QB+3Q+$?PX.
  242. M'[X: +0  _ #\/\DN  #ZPBX X'K [@  <4>$@")1P,''UU?7EI96UC+)HL%
  243. MHQ8 )HM- B:+502P//;EM0 #P;EP%XO:]^&+R+!D]N<#R(/2 +<  \N#T@"2
  244. MD;L+Z??CA]&2]^,#P8/2 )*[!0#V\XK(M0"*Q)B2]_.+T(D.& "T <T:ZY S
  245. MP,T:.PX8 ',$_P86 (D.& "+P8O:T>+1T='BT=$#TQ/!DKD+Z??QB]@SP/?Q
  246. MB].YR #W\8+Z9'(#@NID]8K:T="R -'2N3P ]_&*^O;QAN!0H18 JUBKB\.K
  247. MZ3+_Q!X2 ";'1PX^ 2:,3Q#I(?\                                 
  248. 8                                
  249.  
  250. end
  251. -- 
  252.     Don Simoneaux        Phone:  (214) 964-1859
  253.     3605 Interlaken Dr.
  254.     Plano, TX 75075        USENET:  ...ihnp4!killer!dons
  255.  
  256. ========================================================================
  257. -- Rich Wales // UCLA Computer Science Department // +1 (213) 825-5683
  258.    3531 Boelter Hall // Los Angeles, California 90024-1596 // USA
  259.    wales@CS.UCLA.EDU      ...!(uunet,ucbvax,rutgers)!cs.ucla.edu!wales
  260.    "No, the name of my ship is the _Lollipop_.  It's a good ship."
  261.