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

ID: Q147767

4.00    | 1.00 4.00
WINDOWS | WINDOWS NT kbprg kbbuglist

The information in this article applies to:

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:

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
Keywords          : kbFortranPS kbLangFortran kbbuglist
Version           : 4.00    | 1.00 4.00
Platform          : NT WINDOWS

Last Reviewed: March 3, 1996