8 instantiations of TimeZoneInfo
System.Private.CoreLib (8)
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (5)
88timeZone = new TimeZoneInfo( 895return new TimeZoneInfo( 946return new TimeZoneInfo( 1153zone = new TimeZoneInfo(id, value._baseUtcOffset, value._displayName, value._standardDisplayName, 1173zone = 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
181 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 (string.IsNullOrEmpty(timeZone) || !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)
1782[InlineData(nameof(TimeZoneInfo), nameof(TimeZoneInfo.Local))] 1801[InlineData(nameof(TimeZoneInfo), nameof(TimeZoneInfo.Local))]
Microsoft.Extensions.AI.Abstractions.Tests (16)
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);
Image\DelegatingImageGeneratorTests.cs (4)
96var expectedResult = TimeZoneInfo.Local; 107var tzi = delegating.GetService<TimeZoneInfo>(expectedKey);
SpeechToText\DelegatingSpeechToTextClientTests.cs (4)
138var expectedResult = TimeZoneInfo.Local; 149var tzi = delegating.GetService<TimeZoneInfo>(expectedKey);
Microsoft.Extensions.TimeProvider.Testing (4)
FakeTimeProvider.cs (4)
20private TimeZoneInfo _localTimeZone = TimeZoneInfo.Utc; 179public override TimeZoneInfo LocalTimeZone => _localTimeZone; 185public 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);
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)
246[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 (114)
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; 239/// 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 localTicks = TimeZoneInfo.GetLocalDateTimeNowTicks(utc, out bool isAmbiguousLocalDst); 1711long offset = TimeZoneInfo.GetUtcOffsetFromUtc(this, TimeZoneInfo.Local, out _, out bool isAmbiguousLocalDst).Ticks; 1772=> _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 (65)
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) 152public Dictionary<string, TimeZoneInfo>? _systemTimeZones; 153public ReadOnlyCollection<TimeZoneInfo>? _readOnlySystemTimeZones; 154public ReadOnlyCollection<TimeZoneInfo>? _readOnlyUnsortedSystemTimeZones; 155public Dictionary<string, TimeZoneInfo>? _timeZonesUsingAlternativeIds; 473/// Helper function for retrieving a <see cref="TimeZoneInfo"/> object by time zone name. 477/// This function will either return a valid <see cref="TimeZoneInfo"/> instance or 482/// <returns>Valid <see cref="TimeZoneInfo"/> instance.</returns> 483public static TimeZoneInfo FindSystemTimeZoneById(string id) 485TimeZoneInfo? value; 505/// Helper function for retrieving a <see cref="TimeZoneInfo"/> object by time zone name. 509/// This function will either return <c>true</c> and a valid <see cref="TimeZoneInfo"/> 513/// <param name="timeZoneInfo">A valid retrieved <see cref="TimeZoneInfo"/> or <c>null</c>.</param> 514/// <returns><c>true</c> if the <see cref="TimeZoneInfo"/> object was successfully retrieved, <c>false</c> otherwise.</returns> 515public static bool TryFindSystemTimeZoneById(string id, [NotNullWhenAttribute(true)] out TimeZoneInfo? timeZoneInfo) 524/// <c>TimeZoneInfoResult.Success</c> and a valid <see cref="TimeZoneInfo"/>instance and <c>null</c> Exception or 525/// <c>TimeZoneInfoResult.TimeZoneNotFoundException</c> and <c>null</c> <see cref="TimeZoneInfo"/> and Exception (can be null) or 526/// other <c>TimeZoneInfoResult</c> and <c>null</c> <see cref="TimeZoneInfo"/> and valid Exception. 528private static TimeZoneInfoResult TryFindSystemTimeZoneById(string id, out TimeZoneInfo? timeZone, out Exception? e) 584public static DateTimeOffset ConvertTime(DateTimeOffset dateTimeOffset, TimeZoneInfo destinationTimeZone) 604public static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo destinationTimeZone) 614TimeZoneInfo sourceTimeZone = dateTime.Kind == DateTimeKind.Utc ? s_utcTimeZone : cachedData.Local; 621public static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone) => 627internal static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags) => 630private static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags, CachedData cachedData) 680public static DateTime ConvertTimeFromUtc(DateTime dateTime, TimeZoneInfo destinationTimeZone) => 709public static DateTime ConvertTimeToUtc(DateTime dateTime, TimeZoneInfo sourceTimeZone) => 716public bool Equals([NotNullWhen(true)] TimeZoneInfo? other) => 721public override bool Equals([NotNullWhen(true)] object? obj) => Equals(obj as TimeZoneInfo); 723public static TimeZoneInfo FromSerializedString(string source) 743public static ReadOnlyCollection<TimeZoneInfo> GetSystemTimeZones() => GetSystemTimeZones(skipSorting: false); 752public static ReadOnlyCollection<TimeZoneInfo> GetSystemTimeZones(bool skipSorting) 769TimeZoneInfo[] array = new TimeZoneInfo[cachedData._systemTimeZones.Count]; 784cachedData._readOnlySystemTimeZones = cachedData._readOnlyUnsortedSystemTimeZones = new ReadOnlyCollection<TimeZoneInfo>(array); 788cachedData._readOnlyUnsortedSystemTimeZones = new ReadOnlyCollection<TimeZoneInfo>(array); 793cachedData._readOnlySystemTimeZones = cachedData._readOnlyUnsortedSystemTimeZones = ReadOnlyCollection<TimeZoneInfo>.Empty; 804public bool HasSameRules(TimeZoneInfo other) 831public static TimeZoneInfo Local => s_cachedData.Local; 857public static TimeZoneInfo Utc => s_utcTimeZone; 885public static TimeZoneInfo CreateCustomTimeZone( 909public static TimeZoneInfo CreateCustomTimeZone( 930public static TimeZoneInfo CreateCustomTimeZone( 1115private static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone) => 1122private static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings) => 1129internal static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings, out bool isAmbiguousLocalDst) 1139private static TimeZoneInfoResult TryGetTimeZone(string id, bool dstDisabled, out TimeZoneInfo? value, out Exception? e, CachedData cachedData, bool alwaysFallbackToLocalMachine = false) 1150TimeZoneInfo? zone = null; 1155value._equivalentZones = new List<TimeZoneInfo>(); 1163foreach (TimeZoneInfo tzi in value._equivalentZones) 1182cachedData._timeZonesUsingAlternativeIds ??= new Dictionary<string, TimeZoneInfo>(StringComparer.OrdinalIgnoreCase); 1194private static TimeZoneInfoResult TryGetTimeZoneUsingId(string id, bool dstDisabled, out TimeZoneInfo? value, out Exception? e, CachedData cachedData, bool alwaysFallbackToLocalMachine) 1262private static TimeZoneInfoResult TryGetTimeZoneFromLocalMachine(string id, bool dstDisabled, out TimeZoneInfo? value, out Exception? e, CachedData cachedData) 1272cachedData._systemTimeZones ??= new Dictionary<string, TimeZoneInfo>(StringComparer.OrdinalIgnoreCase) 1374private 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) 486private static TimeZoneInfo GetLocalTimeZoneFromTzFile() 494TimeZoneInfo? 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)
855[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.TimeZoneInfo))]