Solved

SetSytemTime and summertime ?

Posted on 1997-07-27
7
254 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 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

21 Experts available now in Live!

Get 1:1 Help Now