Solved

SetSytemTime and summertime ?

Posted on 1997-07-27
7
255 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now