8 instantiations of TimeZoneInfo
System.Private.CoreLib (8)
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (5)
88timeZone = new TimeZoneInfo( 1036return new TimeZoneInfo( 1087return new TimeZoneInfo( 2012zone = new TimeZoneInfo(id, value!._baseUtcOffset, value!._displayName, value!._standardDisplayName, 2032zone = new TimeZoneInfo(id, value!._baseUtcOffset, value!._displayName, value!._standardDisplayName,
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.StringSerializer.cs (1)
110return new TimeZoneInfo(id, baseUtcOffset, displayName, standardName, daylightName, rules, disableDaylightSavingTime: false);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (2)
331return new TimeZoneInfo(rawData, id, dstDisabled: false); // create a TimeZoneInfo instance from the TZif data w/ DST support 338return new TimeZoneInfo(rawData, id, dstDisabled: true); // create a TimeZoneInfo instance from the TZif data w/o DST support
179 references to TimeZoneInfo
Aspire.Dashboard (8)
Extensions\TimeProviderExtensions.cs (3)
12var dateTime = TimeZoneInfo.ConvertTimeFromUtc(utcDateTimeOffset.UtcDateTime, timeProvider.LocalTimeZone); 20return TimeZoneInfo.ConvertTime(utcDateTimeOffset, timeProvider.LocalTimeZone); 34var local = TimeZoneInfo.ConvertTimeFromUtc(dateTime, timeProvider.LocalTimeZone);
Model\BrowserTimeProvider.cs (5)
16private TimeZoneInfo? _browserLocalTimeZone; 23public override TimeZoneInfo LocalTimeZone 30if (!TimeZoneInfo.TryFindSystemTimeZoneById(timeZone, out var timeZoneInfo)) 33timeZoneInfo = TimeZoneInfo.Utc;
Aspire.Dashboard.Components.Tests (3)
Shared\TestTimeProvider.cs (3)
11private TimeZoneInfo? _localTimeZone; 25public override TimeZoneInfo LocalTimeZone => _localTimeZone ??= TimeZoneInfo.CreateCustomTimeZone(nameof(TestTimeProvider), TimeSpan.FromHours(1), nameof(TestTimeProvider), nameof(TestTimeProvider));
dotnet-svcutil-lib (7)
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\SqlUtils.cs (2)
851return TimeZoneInfo.ConvertTime(d.AddMinutes(adj), TimeZoneInfo.Local);
FrameworkFork\Microsoft.Xml\Xml\schema\XsdDateTime.cs (4)
179TimeSpan utcOffset = TimeZoneInfo.Local.GetUtcOffset(dateTime); 435ticks += TimeZoneInfo.Local.GetUtcOffset(result).Ticks; 448ticks += TimeZoneInfo.Local.GetUtcOffset(result).Ticks; 496result = new DateTimeOffset(dt, TimeZoneInfo.Local.GetUtcOffset(dt));
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlConverter.cs (1)
1108TimeSpan ts = TimeZoneInfo.Local.GetUtcOffset(value);
Microsoft.AspNetCore.Mvc.RazorPages.Test (2)
ApplicationModels\TempDataFilterPageApplicationModelProviderTest.cs (2)
51$"TempData serializer '{typeof(DefaultTempDataSerializer)}' cannot serialize property '{type}.TimeZone' of type '{typeof(TimeZoneInfo)}'."; 178public TimeZoneInfo TimeZone { get; set; }
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (2)
Filters\TempDataApplicationModelProviderTest.cs (2)
53$"TempData serializer '{typeof(DefaultTempDataSerializer)}' cannot serialize property '{type}.TimeZone' of type '{typeof(TimeZoneInfo)}'."; 151public TimeZoneInfo TimeZone { get; set; }
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (4)
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProviderTests.cs (4)
1914[InlineData(nameof(TimeZoneInfo), nameof(TimeZoneInfo.Local))] 1936[InlineData(nameof(TimeZoneInfo), nameof(TimeZoneInfo.Local))]
Microsoft.Extensions.AI.Abstractions.Tests (8)
ChatCompletion\DelegatingChatClientTests.cs (4)
137var expectedResult = TimeZoneInfo.Local; 148var tzi = delegating.GetService<TimeZoneInfo>(expectedKey);
Embeddings\DelegatingEmbeddingGeneratorTests.cs (4)
98var expectedResult = TimeZoneInfo.Local; 109var service = delegating.GetService<TimeZoneInfo>(expectedKey);
Microsoft.Extensions.TimeProvider.Testing (4)
FakeTimeProvider.cs (4)
22private TimeZoneInfo _localTimeZone = TimeZoneInfo.Utc; 183public override TimeZoneInfo LocalTimeZone => _localTimeZone; 189public void SetLocalTimeZone(TimeZoneInfo localTimeZone) => _localTimeZone = Throw.IfNull(localTimeZone);
Microsoft.Extensions.TimeProvider.Testing.Tests (6)
FakeTimeProviderTests.cs (6)
141var localTimeZone = timeProvider.LocalTimeZone; 143Assert.Equal(TimeZoneInfo.Utc, localTimeZone); 151var localTimeZone = timeProvider.LocalTimeZone; 152Assert.Equal(TimeZoneInfo.Utc, localTimeZone); 154var tz = TimeZoneInfo.CreateCustomTimeZone("DUMMY", TimeSpan.FromHours(2), null, null);
Microsoft.Maui.Controls.Compatibility (1)
iOS\FormsApplicationDelegate.cs (1)
73 TimeZoneInfo.ClearCachedData();
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
1196[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.TimeZoneInfo))]
netstandard (1)
netstandard.cs (1)
2163[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.TimeZoneInfo))]
System.Core (1)
System.Core.cs (1)
245[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.TimeZoneInfo))]
System.Net.Mail (2)
System\Net\Mail\MailBnfHelper.cs (1)
277string offset = TimeZoneInfo.Local.GetUtcOffset(value).ToString();
System\Net\Mime\SmtpDateTime.cs (1)
107TimeSpan localTimeZone = TimeZoneInfo.Local.GetUtcOffset(value);
System.Private.CoreLib (119)
src\libraries\Common\src\System\TimeProvider.cs (8)
15/// a time zone based on <see cref="TimeZoneInfo.Local"/>, a high-performance time stamp based on <see cref="Stopwatch"/>, 19/// If the <see cref="TimeZoneInfo.Local"/> changes after the object is returned, the change will be reflected in any subsequent operations that retrieve <see cref="GetLocalNow"/>. 50TimeZoneInfo zoneInfo = LocalTimeZone; 75/// Gets a <see cref="TimeZoneInfo"/> object that represents the local time zone according to this <see cref="TimeProvider"/>'s notion of time. 78/// The default implementation returns <see cref="TimeZoneInfo.Local"/>. 80public virtual TimeZoneInfo LocalTimeZone => TimeZoneInfo.Local; 242/// provided by <see cref="TimeProvider"/> which uses <see cref="DateTimeOffset.UtcNow"/>, <see cref="TimeZoneInfo.Local"/>, <see cref="Stopwatch"/>, and <see cref="Timer"/>.
src\libraries\System.Private.CoreLib\src\System\CurrentSystemTimeZone.cs (7)
25TimeZoneInfo local = TimeZoneInfo.Local; 130if (TimeZoneInfo.Local.SupportsDaylightSavingTime) 132foreach (TimeZoneInfo.AdjustmentRule rule in TimeZoneInfo.Local.GetAdjustmentRules()) 136start = TimeZoneInfo.TransitionTimeToDateTime(year, rule.DaylightTransitionStart); 137end = TimeZoneInfo.TransitionTimeToDateTime(year, rule.DaylightTransitionEnd);
src\libraries\System.Private.CoreLib\src\System\DateTime.cs (9)
1226offsetTicks = TimeZoneInfo.GetLocalUtcOffset(ticks < MinTicks ? MinValue : MaxValue, TimeZoneInfoOptions.NoThrowOnInvalidTime).Ticks; 1233offsetTicks = TimeZoneInfo.GetUtcOffsetFromUtc(utcDt, TimeZoneInfo.Local, out _, out isAmbiguousLocalDst).Ticks; 1304return TimeZoneInfo.Local.IsDaylightSavingTime(this, TimeZoneInfoOptions.NoThrowOnInvalidTime); 1327TimeSpan offset = TimeZoneInfo.GetLocalUtcOffset(this, TimeZoneInfoOptions.NoThrowOnInvalidTime); 1512long offset = TimeZoneInfo.GetDateTimeNowUtcOffsetFromUtc(utc, out bool isAmbiguousLocalDst).Ticks; 1720long offset = TimeZoneInfo.GetUtcOffsetFromUtc(this, TimeZoneInfo.Local, out _, out bool isAmbiguousLocalDst).Ticks; 1781=> _dateData >> KindShift == (int)DateTimeKind.Utc ? this : TimeZoneInfo.ConvertTimeToUtc(this, TimeZoneInfoOptions.NoThrowOnInvalidTime);
src\libraries\System.Private.CoreLib\src\System\DateTimeOffset.cs (3)
94TimeSpan offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime); 112if (offset != TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime)) 779TimeSpan offset = TimeZoneInfo.GetLocalUtcOffset(utcDateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureInfo.cs (1)
768TimeZoneInfo.ClearCachedData();
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (4)
799offset = TimeZoneInfo.GetLocalUtcOffset(DateTime.Now, TimeZoneInfoOptions.NoThrowOnInvalidTime); 807offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime); 865offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime); 1452offset = TimeZoneInfo.Local.GetUtcOffset(dateTime);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeParse.cs (6)
2769result.timeZoneOffset = TimeZoneInfo.GetLocalUtcOffset(result.parsedDate, TimeZoneInfoOptions.NoThrowOnInvalidTime); 2826result.timeZoneOffset = TimeZoneInfo.GetLocalUtcOffset(result.parsedDate, TimeZoneInfoOptions.NoThrowOnInvalidTime); 2907TimeZoneInfo tz = TimeZoneInfo.Local; 2939resultTicks += TimeZoneInfo.GetUtcOffsetFromUtc(utcDt, TimeZoneInfo.Local, out _, out isAmbiguousLocalDst).Ticks;
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (70)
34public sealed partial class TimeZoneInfo : IEquatable<TimeZoneInfo?>, ISerializable, IDeserializationCallback 54private List<TimeZoneInfo>? _equivalentZones; 60private static readonly TimeZoneInfo s_utcTimeZone = CreateUtcTimeZone(); 74private volatile TimeZoneInfo? _localTimeZone; 76private TimeZoneInfo CreateLocal() 80TimeZoneInfo? timeZone = _localTimeZone; 104public TimeZoneInfo Local => _localTimeZone ?? CreateLocal(); 109public DateTimeKind GetCorrespondingKind(TimeZoneInfo? timeZone) 135public Dictionary<string, TimeZoneInfo>? _systemTimeZones; 136public ReadOnlyCollection<TimeZoneInfo>? _readOnlySystemTimeZones; 137public ReadOnlyCollection<TimeZoneInfo>? _readOnlyUnsortedSystemTimeZones; 138public Dictionary<string, TimeZoneInfo>? _timeZonesUsingAlternativeIds; 594/// Helper function for retrieving a <see cref="TimeZoneInfo"/> object by time zone name. 598/// This function will either return a valid <see cref="TimeZoneInfo"/> instance or 603/// <returns>Valid <see cref="TimeZoneInfo"/> instance.</returns> 604public static TimeZoneInfo FindSystemTimeZoneById(string id) 606TimeZoneInfo? value; 626/// Helper function for retrieving a <see cref="TimeZoneInfo"/> object by time zone name. 630/// This function will either return <c>true</c> and a valid <see cref="TimeZoneInfo"/> 634/// <param name="timeZoneInfo">A valid retrieved <see cref="TimeZoneInfo"/> or <c>null</c>.</param> 635/// <returns><c>true</c> if the <see cref="TimeZoneInfo"/> object was successfully retrieved, <c>false</c> otherwise.</returns> 636public static bool TryFindSystemTimeZoneById(string id, [NotNullWhenAttribute(true)] out TimeZoneInfo? timeZoneInfo) 645/// <c>TimeZoneInfoResult.Success</c> and a valid <see cref="TimeZoneInfo"/>instance and <c>null</c> Exception or 646/// <c>TimeZoneInfoResult.TimeZoneNotFoundException</c> and <c>null</c> <see cref="TimeZoneInfo"/> and Exception (can be null) or 647/// other <c>TimeZoneInfoResult</c> and <c>null</c> <see cref="TimeZoneInfo"/> and valid Exception. 649private static TimeZoneInfoResult TryFindSystemTimeZoneById(string id, out TimeZoneInfo? timeZone, out Exception? e) 705public static DateTimeOffset ConvertTime(DateTimeOffset dateTimeOffset, TimeZoneInfo destinationTimeZone) 725public static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo destinationTimeZone) 735TimeZoneInfo sourceTimeZone = dateTime.Kind == DateTimeKind.Utc ? s_utcTimeZone : cachedData.Local; 742public static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone) => 748internal static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags) => 751private static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags, CachedData cachedData) 821public static DateTime ConvertTimeFromUtc(DateTime dateTime, TimeZoneInfo destinationTimeZone) => 850public static DateTime ConvertTimeToUtc(DateTime dateTime, TimeZoneInfo sourceTimeZone) => 857public bool Equals([NotNullWhen(true)] TimeZoneInfo? other) => 862public override bool Equals([NotNullWhen(true)] object? obj) => Equals(obj as TimeZoneInfo); 864public static TimeZoneInfo FromSerializedString(string source) 884public static ReadOnlyCollection<TimeZoneInfo> GetSystemTimeZones() => GetSystemTimeZones(skipSorting: false); 893public static ReadOnlyCollection<TimeZoneInfo> GetSystemTimeZones(bool skipSorting) 910TimeZoneInfo[] array = new TimeZoneInfo[cachedData._systemTimeZones.Count]; 925cachedData._readOnlySystemTimeZones = cachedData._readOnlyUnsortedSystemTimeZones = new ReadOnlyCollection<TimeZoneInfo>(array); 929cachedData._readOnlyUnsortedSystemTimeZones = new ReadOnlyCollection<TimeZoneInfo>(array); 934cachedData._readOnlySystemTimeZones = cachedData._readOnlyUnsortedSystemTimeZones = ReadOnlyCollection<TimeZoneInfo>.Empty; 945public bool HasSameRules(TimeZoneInfo other) 972public static TimeZoneInfo Local => s_cachedData.Local; 998public static TimeZoneInfo Utc => s_utcTimeZone; 1026public static TimeZoneInfo CreateCustomTimeZone( 1050public static TimeZoneInfo CreateCustomTimeZone( 1071public static TimeZoneInfo CreateCustomTimeZone( 1311private static DateTime ConvertUtcToTimeZone(long ticks, TimeZoneInfo destinationTimeZone, out bool isAmbiguousLocalDst) 1461private static bool GetIsDaylightSavingsFromUtc(DateTime time, int year, TimeSpan utc, AdjustmentRule rule, int? ruleIndex, out bool isAmbiguousLocalDst, TimeZoneInfo zone) 1575private static bool TryGetEndOfDstIfYearStartWithDst(int nextYear, TimeSpan utc, TimeZoneInfo zone, out DateTime dstEnd) 1625private static bool TryGetStartOfDstIfYearEndWithDst(int previousYear, TimeSpan utc, TimeZoneInfo zone, out DateTime dstStart) 1836private static TimeSpan GetUtcOffset(DateTime time, TimeZoneInfo zone) 1859private static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone) => 1866private static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings) => 1873internal static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings, out bool isAmbiguousLocalDst) 1998private static TimeZoneInfoResult TryGetTimeZone(string id, bool dstDisabled, out TimeZoneInfo? value, out Exception? e, CachedData cachedData, bool alwaysFallbackToLocalMachine = false) 2009TimeZoneInfo? zone = null; 2014value!._equivalentZones = new List<TimeZoneInfo>(); 2022foreach (TimeZoneInfo tzi in value!._equivalentZones) 2041cachedData._timeZonesUsingAlternativeIds ??= new Dictionary<string, TimeZoneInfo>(StringComparer.OrdinalIgnoreCase); 2053private static TimeZoneInfoResult TryGetTimeZoneUsingId(string id, bool dstDisabled, out TimeZoneInfo? value, out Exception? e, CachedData cachedData, bool alwaysFallbackToLocalMachine) 2121private static TimeZoneInfoResult TryGetTimeZoneFromLocalMachine(string id, bool dstDisabled, out TimeZoneInfo? value, out Exception? e, CachedData cachedData) 2131cachedData._systemTimeZones ??= new Dictionary<string, TimeZoneInfo>(StringComparer.OrdinalIgnoreCase) 2233private static TimeZoneInfo CreateUtcTimeZone()
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.StringSerializer.cs (2)
42public static string GetSerializedString(TimeZoneInfo zone) 97public static TimeZoneInfo GetDeserializedTimeZoneInfo(string source)
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (5)
291cachedData._systemTimeZones ??= new Dictionary<string, TimeZoneInfo>(StringComparer.OrdinalIgnoreCase) 313private static TimeZoneInfo GetLocalTimeZone(CachedData cachedData) 320private static TimeZoneInfoResult TryGetTimeZoneFromLocalMachine(string id, out TimeZoneInfo? value, out Exception? e) 325private static TimeZoneInfo? GetTimeZoneFromTzData(byte[]? rawData, string id) 354private static TimeZoneInfoResult TryGetTimeZone(string id, out TimeZoneInfo? timeZone, out Exception? e, CachedData cachedData)
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.NonAndroid.cs (4)
27private static TimeZoneInfo GetLocalTimeZoneCore() 73private static TimeZoneInfoResult TryGetTimeZoneFromLocalMachineCore(string id, out TimeZoneInfo? value, out Exception? e) 593private static TimeZoneInfo GetLocalTimeZoneFromTzFile() 601TimeZoneInfo? result = GetTimeZoneFromTzData(rawData, id);
System.Private.DataContractSerialization (3)
System\Runtime\Serialization\Json\JsonWriterDelegator.cs (2)
194tickCount -= TimeZoneInfo.Local.GetUtcOffset(value).Ticks; 211TimeSpan ts = TimeZoneInfo.Local.GetUtcOffset(value.ToLocalTime());
System\Xml\XmlConverter.cs (1)
1066TimeSpan ts = TimeZoneInfo.Local.GetUtcOffset(value);
System.Private.Xml (6)
System\Xml\BinaryXml\SqlUtils.cs (2)
552return TimeZoneInfo.ConvertTime(d.AddMinutes(adj), TimeZoneInfo.Local);
System\Xml\Schema\XsdDateTime.cs (4)
186TimeSpan utcOffset = TimeZoneInfo.Local.GetUtcOffset(dateTime); 416ticks += TimeZoneInfo.Local.GetUtcOffset(result).Ticks; 429ticks += TimeZoneInfo.Local.GetUtcOffset(result).Ticks; 477result = new DateTimeOffset(dt, TimeZoneInfo.Local.GetUtcOffset(dt));
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
844[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.TimeZoneInfo))]