From 2a5fc06d641d0fdad43b7c42dcadf9cfe8643af9 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Mon, 23 Feb 2015 15:44:23 -0500 Subject: [PATCH] Change MRES to use DateTime.UtcNow instead of Now In debug builds, ManualResetEventSlim is storing the last time that Set and Reset are called, using DateTime.Now. This in turn requires time zone information, which is currently not implemented on Unix, causing any usage of ManualResetEventSlim.Set/Reset in a debug build to throw a NotImplementedException. This change just switches the usage to be DateTime.UtcNow instead of DateTime.Now to avoid the need for time zone information. I was tempted to remove these debug-only fields entirely, but in case someone's actually using them during debugging, doesn't seem particularly harmful to leave them. --- src/mscorlib/src/System/Threading/ManualResetEventSlim.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mscorlib/src/System/Threading/ManualResetEventSlim.cs b/src/mscorlib/src/System/Threading/ManualResetEventSlim.cs index 0be80fb..86fb347 100644 --- a/src/mscorlib/src/System/Threading/ManualResetEventSlim.cs +++ b/src/mscorlib/src/System/Threading/ManualResetEventSlim.cs @@ -373,7 +373,7 @@ namespace System.Threading } #if DEBUG - m_lastSetTime = DateTime.Now.Ticks; + m_lastSetTime = DateTime.UtcNow.Ticks; #endif } @@ -404,7 +404,7 @@ namespace System.Threading IsSet = false; #if DEBUG - m_lastResetTime = DateTime.Now.Ticks; + m_lastResetTime = DateTime.UtcNow.Ticks; #endif } -- 2.7.4