Skip to content

Commit

Permalink
Improved support for TimeZoneInfo under windows.
Browse files Browse the repository at this point in the history
When cross compiling with gcc, LIBC is defined and
thus never checks the registry for the timezone information.

This change is released under the MIT license.

(cherry picked from commit b3eccc8)
  • Loading branch information
alesliehughes authored and Vincent Povirk committed Feb 26, 2015
1 parent 9092ab9 commit fd4d69f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions mcs/class/System.Core/System/TimeZoneInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,14 @@ static TimeZoneInfo CreateLocal ()
using (Stream stream = GetMonoTouchData (null)) {
return BuildFromStream ("Local", stream);
}
#elif LIBC
#else
if (IsWindows && LocalZoneKey != null) {
string name = (string)LocalZoneKey.GetValue ("TimeZoneKeyName");
name = TrimSpecial (name);
if (name != null)
return TimeZoneInfo.FindSystemTimeZoneById (name);
}

var tz = Environment.GetEnvironmentVariable ("TZ");
if (tz != null) {
if (tz == String.Empty)
Expand All @@ -137,15 +144,6 @@ static TimeZoneInfo CreateLocal ()
return null;
}
}
#else
if (IsWindows && LocalZoneKey != null) {
string name = (string)LocalZoneKey.GetValue ("TimeZoneKeyName");
name = TrimSpecial (name);
if (name != null)
return TimeZoneInfo.FindSystemTimeZoneById (name);
}

return null;
#endif
}

Expand Down

0 comments on commit fd4d69f

Please sign in to comment.