On May 10, 2012, at 8:20 AM, Hänke, Maik wrote:
> I tried to react to time changes, but in the callback I got the old time.

Let me see if I understand the scenario:

1. You launch your app, and access e.g. TimeZoneInfo.Local
2. You change your system timezone
3. Your app doesn't see the timezone change.

The problem is that we only lookup the timezone once, and cache that value:

        
https://github.com/mono/mono/blob/master/mcs/class/System.Core/System/TimeZoneInfo.cs#L84

Subsequent access to TimeZoneInfo.Local will have TimeZoneInfo.local as a 
non-null value, and thus the timezone won't be looked up again.

Oops.

Could you please file a bug with a test case so that we don't forget about 
fixing this?

The easiest way to workaround this would be to trigger a process restart if you 
notice that the timezone changes. (I didn't say "best", I said "easiest.")

Another approach may be to null out the TimeZoneInfo.local and 
TimeZoneInfo.ZoneInfoDB.defaultZone fields (yay Reflection?), which would 
should cause Mono to re-lookup the timezone the next time TimeZoneInfo.Local is 
accessed.

 - Jon

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to