Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

SetSytemTime and summertime ?

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
rli
Asked:
rli
  • 4
  • 3
1 Solution
 
rliAuthor Commented:
Adjusted points to 140
0
 
WilfredCommented:
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
 
rliAuthor Commented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
WilfredCommented:
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
 
rliAuthor Commented:
I use NT4.0(SP3) english version, so there doesn´t seem to be a patch does it ? Any other clue ?
0
 
WilfredCommented:
I'm affraid not. Sorry....
0
 
WilfredCommented:
Uh... by the way, I accidently anwsered your question instead of adding some comment.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now