Solved

SetSytemTime and summertime ?

Posted on 1997-07-27
7
261 Views
Last Modified: 2010-04-04
I'm trying to set the time by calling SetSytemTime but
it behaves a bit strange due to the W. Europe Daylight Time !

If a try to set a time it automatically adds an extra hour to
the value I've given if the the current date is within the period march 3 -october 26 when we daylight time in the time zone (GMT +01.00). This appears even if I take the value I want to set from the current time ! (e.g. SetSystemTime(Now) returns Now + 1h. !)

If I change the time zone to for instance Kabul (GMT +4.30) or change the current date to one outside the period above everything works fine and the time is set to the value I wanted.

Why does the function behave like this ? Is there a way of finding out if the current date is within the daylight time period ?

This is the code I use, is something wrong ?


function SetPCSystemTime(tDati: TDateTime): Boolean;
var
   tSetDati: TDateTime;
   vDatiBias: Variant;
   tTZI: TTimeZoneInformation;
   tST, tSTLT: TSystemTime;
begin
   GetTimeZoneInformation(tTZI);
   vDatiBias := tTZI.Bias / 1440;
   tSetDati := tDati + vDatiBias;
   with tST do
   begin
        wYear := StrToInt(FormatDateTime('yyyy', tSetDati));
        wMonth := StrToInt(FormatDateTime('mm', tSetDati));
        wDay := StrToInt(FormatDateTime('dd', tSetDati));
        wHour := StrToInt(FormatDateTime('hh', tSetDati));
        wMinute := StrToInt(FormatDateTime('nn', tSetDati));
        wSecond := 0;
        wMilliseconds := 0;
   end;
   SetPCSystemTime := SetSystemTime(tST);
end;

procedure TForm1.Button1Click(Sender: TObject);
var t,t2 : TDateTime;
begin
  t2 := date;
  t := strToTime(edit1.text);
  setPCSystemTime(t + t2);
end;
0
Comment
Question by:rli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 

Author Comment

by:rli
ID: 1340070
Adjusted points to 140
0
 

Expert Comment

by:Wilfred
ID: 1340071
I do not know if this helps but...

There is a patch for windows 95 concerning western europe's timezone wichwill adjust the daylight ssaving settings for this time zone to the last sunday of oktober.

It's called 95dlight.exe, mayby this will help?
0
 

Author Comment

by:rli
ID: 1340072
Not actually if the patch isn't valid for NT cause I'm running under NT4.0(SP3).
Is there a similiar patch for NT ?

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:Wilfred
ID: 1340073
If there is one, it should be on technet. Do you have the english version of NT or a different one?
If you use the english version then there isn't a patch (as all patches are contained in SP3 except the most current ones). If you use a different version and there is a patch it should be on the international supplement CD of technet.
0
 

Author Comment

by:rli
ID: 1340074
I use NT4.0(SP3) english version, so there doesn´t seem to be a patch does it ? Any other clue ?
0
 

Accepted Solution

by:
Wilfred earned 140 total points
ID: 1340075
I'm affraid not. Sorry....
0
 

Expert Comment

by:Wilfred
ID: 1340076
Uh... by the way, I accidently anwsered your question instead of adding some comment.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month9 days, 5 hours left to enroll

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question