KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q25989: DATE$, TIME$ in Loop Can Push System Time Backwards in DOS 3.x

Article: Q25989
Product(s): See article
Version(s): 3.00 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | TAR67824 B_BasicCom | mspl13_basic
Last Modified: 31-AUG-1989

The following BASIC program makes the system time go backwards when
run under MS-DOS Versions 3.x.

FOR i = 1 TO 40
   DATE$ = "11/17/87"
   PRINT TIME$
NEXT

This behavior is caused by a DOS Versions 3.x problem, not a BASIC
problem. The problem does not occur in MS OS/2 real mode.

As a workaround, do not reset the date multiple times within a loop.

This information applies to Microsoft QuickBASIC Versions 3.00, 4.00,
4.00b, and 4.50 and to Microsoft BASIC Compiler Versions 6.00 and
6.00b when run under MS-DOS Versions 3.x.

For related information concerning Microsoft C, query on the following
words:

   _DOS_SETDATE and CLOCK and TIME and C

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.