Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Before 2011 year Moscow had +3 GMT timezone with daylight saving time, so it was +4 GMT between March and October. In 2011 October return to +3 GMT was cancelled, so it's +4 GMT from March 2011 permanently. In applications using Mono and MonoTouch Moscow time handled incorrectly. For example, DateTime.Now.ToString() returns time less by hour.
After discovering how Mono detects current system daylight saving periods I found that it uses System.CurrentSystemTimeZone.GetTimeZoneData method. For Moscow timezone and 2011 year it returns (634367880000000000, 0, 108000000000, 36000000000). So daylight saving starts at 27 March 2011 and don't have end. But System.CurrentSystemTimeZone.IsDaylightSavingTime method cannot handle DaylightTime without end. It always returns false.
Adding this to end of System.CurrentSystemTimeZone.IsDaylightSavingTime can solve the problem:
if (daylightTimes.End.Ticks == 0 && time.Ticks > daylightTimes.Start.Ticks)
So it will correctly return true for date after 27 March 2011.
Or maybe System.CurrentSystemTimeZone.GetTimeZoneData should return end of year instead of 0.
I think this is solved by the patch in bug #2223
If someone can confirm, I can get this patch pushed into MonoTouch/MonoDroid
*** Bug 1337 has been marked as a duplicate of this bug. ***
This issue no longer exists in mono 4.2.