aports/testing/mono/assume-UTC-if-no-TZ-set.patch
2015-10-07 07:47:13 +00:00

32 lines
1.0 KiB
Diff

From cf4e7339e31d19e6934d7b8130f82697212ea39e Mon Sep 17 00:00:00 2001
From: Marcin Cieslak <saper@saper.info>
Date: Sun, 7 Jun 2015 20:14:47 +0000
Subject: [PATCH] [corlib] Assume UTC if no $TZ set. Fixes #30360
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 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mcs/class/corlib/System/TimeZoneInfo.cs b/mcs/class/corlib/System/TimeZoneInfo.cs
index 717bfa7..6babee8 100644
--- a/mcs/class/corlib/System/TimeZoneInfo.cs
+++ b/mcs/class/corlib/System/TimeZoneInfo.cs
@@ -116,11 +116,11 @@ static TimeZoneInfo CreateLocal ()
try {
return FindSystemTimeZoneByFileName ("Local", "/etc/localtime");
- } catch {
+ } catch (TimeZoneNotFoundException) {
try {
return FindSystemTimeZoneByFileName ("Local", Path.Combine (TimeZoneDirectory, "localtime"));
- } catch {
- return null;
+ } catch (TimeZoneNotFoundException) {
+ return Utc;
}
}
}