Going Mad with SetSystemTime

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Has anyone else noticed that using SetSystemTime:-

[DLLImport("coredll.dll")]
public extern static uint (SetSystemTime(ref SYSTEMTIME lpSystemTime));

....the hour always adds an extra hour to itself. ie if I set the SYSTEMTIME
struct to 13:10 pm then it sets the time on the PDa to 14:10 pm.

Is this a known bug(if so I'll just deduct an hour before the call) or am I
missing something.

Thanks.
Steve.
 
SetSystemTime() sets the time ***in GMT***. SetLocalTime() sets the current
local time, in whatever timezone you find yourself. At a guess, I'd say
that you are one hour east of GMT...

Paul T.
 
Steve,

decucting a constant? What about daylight saving?

System.DateTime oT ;
string cDate = "31.12.2005 23:59:59"; // german DateTimeString
int nOffset = DateTime.Now.ToUniversalTime().Hour - DateTime.Now.Hour;
oT = Convert.ToDateTime( cDate
,System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat );
oT = oT.AddHours( Convert.ToDouble( Convert.ToDouble( nOffset ))) ;
SetSystemTime(oT);

regards
Ruediger
 
Back
Top