TimeZoneInfo.CreateLocal now handles environment variable TZ.
authorMarcos Henrich <marcos.henrich@xamarin.com>
Mon, 6 Oct 2014 14:57:13 +0000 (15:57 +0100)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Mon, 6 Oct 2014 14:57:13 +0000 (15:57 +0100)
mcs/class/System.Core/System/TimeZoneInfo.cs

index 54178376bdd050dcc5e849e6f9f591056b8e51e1..15ee8615aea7b9ca711589a12cad006ba8b64c8b 100644 (file)
@@ -117,6 +117,17 @@ namespace System
                                return BuildFromStream ("Local", stream);
                        }
 #elif LIBC
+                       var tz = Environment.GetEnvironmentVariable ("TZ");
+                       if (tz != null) {
+                               if (tz == String.Empty)
+                                       return Utc;
+                               try {
+                                       return FindSystemTimeZoneByFileName (tz, Path.Combine (TimeZoneDirectory, tz));
+                               } catch {
+                                       return Utc;
+                               }
+                       }
+
                        try {
                                return FindSystemTimeZoneByFileName ("Local", "/etc/localtime");        
                        } catch {