Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SetSytemTime and summertime ?

Posted on 1997-07-27
7
Medium Priority
?
265 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 280 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

721 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