Fix DateTime.Now and CurrentTimeToUtc during DST transition time (#4172)
authorNeale Ferguson <neale@sinenomine.net>
Tue, 14 Feb 2017 13:47:21 +0000 (08:47 -0500)
committerMarek Safar <marek.safar@gmail.com>
Tue, 14 Feb 2017 13:47:21 +0000 (14:47 +0100)
commit16edc1e552f348a5ccdcd0b6e0c191c902f97422
tree14c74323a0d4420665f7a9bc54ae2b0e9735e42c
parent516e1cf79367c22caea1ae897511ab763a616a09
Fix DateTime.Now and CurrentTimeToUtc during DST transition time (#4172)

* During the ambiguous hour .NET will return the DST version of the time whereas mono is returning the base time. Rather than use the transitions array we look up the Adjustment rules (which are created from the transition rules in the first place).

In addition, CurrentTimeToUtc() also has problems around the transition time.

Added test and fixed another.

Fixes #43805.

* Despite the tutorial on msdn about daylight saving time, .NET interprets the 'ambiguous' hour of DST as being DST rather than standard time which is what mono did.
mcs/class/corlib/System/TimeZoneInfo.cs
mcs/class/corlib/Test/System/TimeZoneInfoTest.cs
mcs/class/corlib/Test/System/TimeZoneTest.cs