Skip to content

Commit 9500a30

Browse files
committed
for some regions, specifically Asia/Singapore, the native icall returns incorrectly because the country's timezone changed. In this case in 1981 Asia/Singapore changed from +0730 to +08....Since the UTC offset changed, our logic thinks that daylight savings may have started, and the icall returns incorrect data, which causes the CreateLocalUnity function to throw. Fixing the icall is important, but for the time being we'll wrap the CreateLocalUnity function with a try catch. then fix the native icall...
1 parent 22ca037 commit 9500a30

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

mcs/class/corlib/System/TimeZoneInfo.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,15 @@ static TimeZoneInfo CreateLocal ()
170170
#endif
171171

172172
#if UNITY
173-
var localTimeZoneFallback = CreateLocalUnity();
174-
if(localTimeZoneFallback == null)
175-
localTimeZoneFallback = Utc;
173+
TimeZoneInfo localTimeZoneFallback = null;
174+
try {
175+
localTimeZoneFallback = CreateLocalUnity();
176+
} catch {
177+
localTimeZoneFallback = null;
178+
}
179+
180+
if (localTimeZoneFallback == null)
181+
localTimeZoneFallback = Utc;
176182
#endif
177183

178184
var tz = Environment.GetEnvironmentVariable ("TZ");

0 commit comments

Comments
 (0)