From: LeaFrock Date: Wed, 18 Nov 2020 23:17:17 +0000 (+0800) Subject: Fix discuss #44785:optimize constructor of ElapsedEventArgs (#44853) X-Git-Tag: submit/tizen/20210909.063632~4539 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e3b310a47cb5ae7422f1731f23bbd825332c8f0;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix discuss #44785:optimize constructor of ElapsedEventArgs (#44853) * optimize constructor of ElapsedEventArgs * delete the old ctor --- diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/Timers/ElapsedEventArgs.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/Timers/ElapsedEventArgs.cs index 8b59e07..09051c6 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/Timers/ElapsedEventArgs.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/Timers/ElapsedEventArgs.cs @@ -5,9 +5,9 @@ namespace System.Timers { public class ElapsedEventArgs : EventArgs { - internal ElapsedEventArgs(long fileTime) + internal ElapsedEventArgs(DateTime localTime) { - SignalTime = DateTime.FromFileTime(fileTime); + SignalTime = localTime; } public DateTime SignalTime { get; } diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/Timers/Timer.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/Timers/Timer.cs index bb80804..6812ef0 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/Timers/Timer.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/Timers/Timer.cs @@ -290,7 +290,7 @@ namespace System.Timers _enabled = false; } - ElapsedEventArgs elapsedEventArgs = new ElapsedEventArgs(DateTime.UtcNow.ToFileTime()); + ElapsedEventArgs elapsedEventArgs = new ElapsedEventArgs(DateTime.Now); try { // To avoid race between remove handler and raising the event