summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/DateTime.cs
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2017-02-10 20:35:12 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2017-02-10 20:35:12 +0900
commit4b11dc566a5bbfa1378d6266525c281b028abcc8 (patch)
treeb48831a898906734f8884d08b6e18f1144ee2b82 /src/mscorlib/src/System/DateTime.cs
parentdb20f3f1bb8595633a7e16c8900fd401a453a6b5 (diff)
downloadcoreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.gz
coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.tar.bz2
coreclr-4b11dc566a5bbfa1378d6266525c281b028abcc8.zip
Imported Upstream version 1.0.0.9910upstream/1.0.0.9910
Diffstat (limited to 'src/mscorlib/src/System/DateTime.cs')
-rw-r--r--src/mscorlib/src/System/DateTime.cs15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/mscorlib/src/System/DateTime.cs b/src/mscorlib/src/System/DateTime.cs
index e93346c42f..3de50336a9 100644
--- a/src/mscorlib/src/System/DateTime.cs
+++ b/src/mscorlib/src/System/DateTime.cs
@@ -13,7 +13,6 @@ namespace System {
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
- using System.Security.Permissions;
using System.Diagnostics.Contracts;
using CultureInfo = System.Globalization.CultureInfo;
using Calendar = System.Globalization.Calendar;
@@ -461,7 +460,12 @@ namespace System {
// parts of the result are the same as those of this DateTime.
//
public DateTime AddYears(int value) {
- if (value < -10000 || value > 10000) throw new ArgumentOutOfRangeException("years", Environment.GetResourceString("ArgumentOutOfRange_DateTimeBadYears"));
+ if (value < -10000 || value > 10000)
+ {
+ // DateTimeOffset.AddYears(int years) is implemented on top of DateTime.AddYears(int value). Use the more appropriate
+ // parameter name out of the two for the exception.
+ throw new ArgumentOutOfRangeException("years", Environment.GetResourceString("ArgumentOutOfRange_DateTimeBadYears"));
+ }
Contract.EndContractBlock();
return AddMonths(value * 12);
}
@@ -658,7 +662,6 @@ namespace System {
return new DateTime(DoubleDateToTicks(d), DateTimeKind.Unspecified);
}
- [System.Security.SecurityCritical /*auto-generated_required*/]
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) {
if (info==null) {
throw new ArgumentNullException(nameof(info));
@@ -705,12 +708,6 @@ namespace System {
return (Int64)dateData;
}
}
-
- // Return the underlying data, without adjust local times to the right time zone. Needed if performance
- // or compatibility are important.
- internal Int64 ToBinaryRaw() {
- return (Int64)dateData;
- }
// Returns the date part of this DateTime. The resulting value
// corresponds to this DateTime with the time-of-day part set to