Knowledge Base

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

PSS ID Number: 147767

Article Last Modified on 11/3/1999


The information in this article applies to:


This article was previously published under Q147767

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 query words: 1.00 4.00

Keywords: kbLangFortran KB147767
Technology: kbAudDeveloper kbFORTRANPower400NT kbFortranSearch kbZNotKeyword8