From cf9ba5199e3d6d7b511d05a9020c5afe1563ad75 Mon Sep 17 00:00:00 2001 From: Marc Brooks Date: Tue, 18 Jun 2024 11:15:05 -0500 Subject: [PATCH] Revert Add to int argument Cast at call-site to prevent performance degradation. --- .../src/System/Globalization/Calendar.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/Calendar.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/Calendar.cs index ed8aa88db428e8..49eb9e8cec98e4 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/Calendar.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/Calendar.cs @@ -127,7 +127,7 @@ internal static void CheckAddResult(long ticks, DateTime minValue, DateTime maxV } } - internal DateTime Add(DateTime time, double value, long scale) + internal DateTime Add(DateTime time, double value, int scale) { // From ECMA CLI spec, Partition III, section 3.27: // @@ -169,7 +169,7 @@ public virtual DateTime AddMilliseconds(DateTime time, double milliseconds) /// public virtual DateTime AddDays(DateTime time, int days) { - return Add(time, days, TimeSpan.MillisecondsPerDay); + return Add(time, days, (int)TimeSpan.MillisecondsPerDay); } /// @@ -181,7 +181,7 @@ public virtual DateTime AddDays(DateTime time, int days) /// public virtual DateTime AddHours(DateTime time, int hours) { - return Add(time, hours, TimeSpan.MillisecondsPerHour); + return Add(time, hours, (int)TimeSpan.MillisecondsPerHour); } /// @@ -193,7 +193,7 @@ public virtual DateTime AddHours(DateTime time, int hours) /// public virtual DateTime AddMinutes(DateTime time, int minutes) { - return Add(time, minutes, TimeSpan.MillisecondsPerMinute); + return Add(time, minutes, (int)TimeSpan.MillisecondsPerMinute); } /// @@ -225,7 +225,7 @@ public virtual DateTime AddMinutes(DateTime time, int minutes) /// public virtual DateTime AddSeconds(DateTime time, int seconds) { - return Add(time, seconds, TimeSpan.MillisecondsPerSecond); + return Add(time, seconds, (int)TimeSpan.MillisecondsPerSecond); } // Returns the DateTime resulting from adding a number of