12 private static volatile TimeZone currentTimeZone;
14 private static object s_InternalSyncObject;
16 private static object InternalSyncObject
20 if (s_InternalSyncObject ==
null)
22 object value =
new object();
25 return s_InternalSyncObject;
38 lock (InternalSyncObject)
40 if (currentTimeZone ==
null)
42 currentTimeZone =
new CurrentSystemTimeZone();
44 return currentTimeZone;
66 internal static void ResetTimeZone()
68 if (currentTimeZone !=
null)
70 lock (InternalSyncObject)
72 currentTimeZone =
null;
92 if (num > 3155378975999999999
L)
112 bool isAmbiguousLocalDst =
false;
113 long utcOffsetFromUniversalTime = ((CurrentSystemTimeZone)
CurrentTimeZone).GetUtcOffsetFromUniversalTime(time, ref isAmbiguousLocalDst);
142 return CalculateUtcOffset(time, daylightTimes) !=
TimeSpan.
Zero;
147 if (daylightTimes ==
null)
154 return TimeSpan.Zero;
162 t = end - daylightTimes.
Delta;
168 t2 = dateTime - daylightTimes.
Delta;
173 if (time >= dateTime || time < end)
178 else if (time >= dateTime && time < end)
182 if (flag && time >= t && time < t2)
184 flag = time.IsAmbiguousDaylightSavingTime();
188 return daylightTimes.
Delta;
190 return TimeSpan.Zero;
virtual bool IsDaylightSavingTime(DateTime time)
Returns a value indicating whether the specified date and time is within a daylight saving time perio...
virtual DateTime ToLocalTime(DateTime time)
Returns the local time that corresponds to a specified date and time value.
TimeSpan Delta
Gets the time interval that represents the difference between standard time and daylight saving time.
Represents an instant in time, typically expressed as a date and time of day. To browse the ....
A type representing a date and time value.
abstract string StandardName
Gets the standard time zone name.
long Ticks
Gets the number of ticks that represent the value of the current T:System.TimeSpan structure.
int Year
Gets the year component of the date represented by this instance.
DateTimeKind Kind
Gets a value that indicates whether the time represented by this instance is based on local time,...
DateTime End
Gets the object that represents the date and time when the daylight saving period ends.
static int CompareExchange(ref int location1, int value, int comparand)
Compares two 32-bit signed integers for equality and, if they are equal, replaces the first value.
static bool IsDaylightSavingTime(DateTime time, DaylightTime daylightTimes)
Returns a value indicating whether the specified date and time is within the specified daylight savin...
static readonly TimeSpan Zero
Represents the zero T:System.TimeSpan value. This field is read-only.
DateTime Start
Gets the object that represents the date and time when the daylight saving period begins.
static TimeZone CurrentTimeZone
Gets the time zone of the current computer.
abstract string DaylightName
Gets the daylight saving time zone name.
DateTimeKind
Specifies whether a T:System.DateTime object represents a local time, a Coordinated Universal Time (U...
Represents a time interval.To browse the .NET Framework source code for this type,...
Specifies that the class can be serialized.
Defines the period of daylight saving time.
abstract DaylightTime GetDaylightChanges(int year)
Returns the daylight saving time period for a particular year.
Provides atomic operations for variables that are shared by multiple threads.
virtual DateTime ToUniversalTime(DateTime time)
Returns the Coordinated Universal Time (UTC) that corresponds to a specified time.
abstract TimeSpan GetUtcOffset(DateTime time)
Returns the Coordinated Universal Time (UTC) offset for the specified local time.
long Ticks
Gets the number of ticks that represent the date and time of this instance.