Merge pull request #1696 from esdrubal/tzrefactor
[mono.git] / mcs / class / corlib / System / TimeZoneInfo.cs
index a61f048476015f52cae0657687f4ca9eb62f3d6f..0c17412242c835af7107d559a158ce9be1e25444 100644 (file)
@@ -1295,8 +1295,12 @@ namespace System
                                } else {
                                        if (daylightDisplayName != ttype.Name)
                                                daylightDisplayName = ttype.Name;
-                                       if (dstDelta.TotalSeconds != ttype.Offset - baseUtcOffset.TotalSeconds)
-                                               dstDelta = new TimeSpan(0, 0, ttype.Offset) - baseUtcOffset;
+                                       if (dstDelta.TotalSeconds != ttype.Offset - baseUtcOffset.TotalSeconds) {
+                                               // Round to nearest minute, since it's not possible to create an adjustment rule
+                                               // with sub-minute precision ("The TimeSpan parameter cannot be specified more precisely than whole minutes.")
+                                               // This happens with Europe/Dublin, which had an offset of 34 minutes and 39 seconds in 1916.
+                                               dstDelta = new TimeSpan (0, 0, ttype.Offset - ttype.Offset % 60) - baseUtcOffset;
+                                       }
 
                                        dst_start = ttime;
                                        dst_observed = true;