[corlib] Assume UTC if no $TZ set. Fixes #30360
authorMarcin Cieslak <saper@saper.info>
Sun, 7 Jun 2015 20:14:47 +0000 (20:14 +0000)
committerMarcin Cieslak <saper@saper.info>
Sun, 7 Jun 2015 22:19:56 +0000 (22:19 +0000)
Don't throw System.TimeZoneNotFoundException
if no $TZ is set and there is no /etc/localtime
or similar file.

mcs/class/corlib/System/TimeZoneInfo.cs

index 717bfa77c76f088a90578bb57be795b567fda494..6babee889ca384c087d538644829ade8c5fdfee8 100644 (file)
@@ -116,11 +116,11 @@ namespace System
 
                        try {
                                return FindSystemTimeZoneByFileName ("Local", "/etc/localtime");        
-                       } catch {
+                       } catch (TimeZoneNotFoundException) {
                                try {
                                        return FindSystemTimeZoneByFileName ("Local", Path.Combine (TimeZoneDirectory, "localtime"));   
-                               } catch {
-                                       return null;
+                               } catch (TimeZoneNotFoundException) {
+                                       return Utc;
                                }
                        }
                }