BUG: SETTIM() Function Sets Date Back 1 Day Under Windows NT

Last reviewed: February 29, 1996
Article ID: Q147767
The information in this article applies to:
  • Microsoft Fortran PowerStation for Windows 95 and Windows NT, version 4.0

SYMPTOMS

Using the SETTIM() run-time function under Windows NT version 3.51 causes the system date to be set back by one day when the "Adjust for Daylight Savings Time" option is selected in the Date/Time applet in the Control Panel.

RESOLUTION

Clear the "Automatically Check for Daylight Savings Time" option in the Date/Time applet in the Control Panel before using the SETTIM() function.

-or-

If using the SETTIM() function with the "Adjust for Daylight Savings Time" option selected. Check the system date after using this function and if necessary reset it manually by doing one of the following:

  • At the MS-DOS command prompt, type "date" and press ENTER. Type the month, day, and year using only two digits for each date element.
  • Using the Control Panel, select the Date/Time applet. In the Date/Time dialog box, enter the new date and time.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

To illustrate the problem, build a program using the following sample code. With the "Adjust for Daylight Savings Time" option selected in the Date/Time applet, run the program. Running the program prints the current date but causes the system date to be set back one day.

To check the system date, open the Date/Time applet in the Control Panel or from the MS-DOS command prompt, type "date" and press ENTER. Note the date displayed will be one day less than what was printed for the sample program execution.

Sample Code

C Compile options needed: none

      include 'flib.fi'
      include 'flib.fd'
      integer*2 nowyr,nowmonth,nowday,nowhr,nowmin,nowsec,nowhun
      logical lvar

      call getdat(nowyr,nowmonth,nowday)      ! get current date/time
      call gettim(nowhr,nowmin,nowsec,nowhun)
      write (*,*) nowyr,nowmonth,nowday
      lvar = setdat(int2(1980),int2(5),int2(31))  ! set new date/time
      lvar = settim(int2(0),int2(0),int2(0),int2(0))
      lvar = setdat(nowyr,nowmonth,nowday)        ! restore date/time
      lvar = settim(nowhr,nowmin,nowsec,nowhun)
      end


Additional reference words: 1.00 4.00
KBCategory: kbprg kbbuglist
KBSubcategory: FORTLngIss


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.

Last reviewed: February 29, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.