Daylight Saving problems on CE.NET 4.1

S

Sven Sauter

Hi!

I have a big problem regarding daylight saving on Windows CE 4.1.
This is making me really crazy.

You can see the problem using the Windows CE.NET Emulator 4.1.0 build 14:
Deselect "Automatically adjust daylight saving" (or similar, since I'm using
the german Emulator).

Sometimes, the emulator's time changes very strange:
Set the Time to 25.10.2003 - any time
Then set the time to 26.10.2003 02:59:50 and wait what happens at 03:00. On my
emulator, the time will be set back to 02:59:00 instead on 03:00:00 which is
completely wrong!

Sometimes, the emulator's clock shows changes the time correct to 03:00:xx,
but if you start a small application showing the current date/time using

console.writeline(now)
-> 02:00:xx will be shown.

if you then start a CMD-box, entering "time" -> 03:00:xx is shown.

Any idea why this happens? Is there a bug in CE and/or in the
compactframework?

There is no chance to reproduce this problem in the desktop version.

Thanks a lot
Sven
 
S

Sven Sauter

Dear Alex

Yes, this sounds very relevant, but I can't test it because I get an error:

Dim tz As TimeZone = TimeZone.CurrentTimeZone
Dim fi As FieldInfo = tz.GetType().GetField("currentTimeZone",
BindingFlags.NonPublic Or BindingFlags.Static Or BindingFlags.Instance)
fi.SetValue(Nothing, Nothing)

gives me a System.NullReferenceException at fi.SetValue

Any idea why?

Thanks a lot for your help!
Sven
 
A

Alex Feinman [MVP]

Yes, sorry. There was a minor error. It should have been:
Dim fi As FieldInfo = _

tz.GetType().BaseType.GetField("currentTimeZone", _

BindingFlags.NonPublic Or BindingFlags.Static Or BindingFlags.Instance)
 
S

Sven Sauter

Dear Alex

Thanks, but it doesn't help. I still get the wrong time when the system
changes to winter time.
Even if I restart my application, I get the wrong time.

Anyway, thanks for your help.
Sven
 
S

Sven Sauter

Problem is solved

By using the API "GetSystemTime" you will get the correct time also if your
system changes from summer to winter time:

Private Structure LpSystemTime
Public wYear As Short
Public wMonth As Short
Public wDayOfWeek As Short
Public wDay As Short
Public wHour As Short
Public wMinute As Short
Public wSecond As Short
Public wMilliseconds As Short
End Structure

<DllImport("coredll.dll")> Private Shared Sub GetLocalTime(ByRef SysTime
As LpSystemTime)
End Sub

Sven
 
F

Fernando

Hi Sven,
This seems to be a problem with the WinCE shell, are you seeing any
difference between the dates retrieved by NETCF and native code?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top