Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

daylight savings problem

Status
Not open for further replies.

bwysocki

Programmer
Sep 19, 2001
38
US
Hello all,

A problem came across to me with our DOS application concerning daylight savings time.

The program is compiled in Microsoft C 6.0. The problem seems to happen when running on Windows 2000. We tried the executable on Windows 98SE and it seems to work fine.

Here's the problem. Yesterday (04/04/2004) at 2:00am we were supposed to jump forward to 3:00am. (We are in Central time zone). Windows correctly jumped ahead. However, our application which was running in a DOS window at the time went from 1:59 to 1:00.

The code in question is:

time(clock);
tm=localtime(clock);
asctime(tm);

The time function itself seems to be returning the wrong time. Based on info on Microsoft's web site I went playing with the TZ environment variable. But no avail. It almost seems like it's setting it to Pacific time. (which is the default time zone for TZ)

ugh! I just love when a program function is -no longer supported- :)

Any help would be appreciated,
Bob
 
I'd guess that your old DOS program compiled with your old DOS compiler is getting confused by subtle differences between the real DOS which is win98 and the DOS emulation which is in win2k.

Short of experimenting with some simple test code and a variety of compilers capable of generating code for the two operating systems in question, it's hard to say what the problem is.

> However, our application which was running in a DOS window at the time went from 1:59 to 1:00.
Is it just a problem with the code running whilst the time actually changes (underneath it). Does the problem persist when the program is restarted?

--
 
From what I've seen, if you exit the application and restart from the DOS prompt, it picks up the correct time. This is without ever closing the DOS window.
 
So at the moment, it's just annoying twice a year when the clocks change?
And the simple fix is to stop and restart the program.

--
 
Not quite. The point of the program is to grab the new time and send it to a device. It's looking more and more like we might just have to rewrite the thing as a Visual C++ command line app.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top