8 instantiations of TimeZoneInfo
System.Private.CoreLib (8)
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (5)
88timeZone = new TimeZoneInfo( 919return new TimeZoneInfo( 970return new TimeZoneInfo( 1177zone = new TimeZoneInfo(id, value._baseUtcOffset, value._displayName, value._standardDisplayName, 1197zone = new TimeZoneInfo(id, value._baseUtcOffset, value._displayName, value._standardDisplayName,
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.StringSerializer.cs (1)
163return new TimeZoneInfo(id, baseUtcOffset, displayName, standardName, daylightName, rules, disableDaylightSavingTime: false);
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (2)
345return new TimeZoneInfo(rawData, id, dstDisabled: false); // create a TimeZoneInfo instance from the TZif data w/ DST support 352return new TimeZoneInfo(rawData, id, dstDisabled: true); // create a TimeZoneInfo instance from the TZif data w/o DST support
195 references to TimeZoneInfo
aspire (3)
src\Shared\TimeProviderExtensions.cs (3)
10var dateTime = TimeZoneInfo.ConvertTimeFromUtc(utcDateTimeOffset.UtcDateTime, timeProvider.LocalTimeZone); 18return TimeZoneInfo.ConvertTime(utcDateTimeOffset, timeProvider.LocalTimeZone); 32var local = TimeZoneInfo.ConvertTimeFromUtc(dateTime, timeProvider.LocalTimeZone);
Aspire.Dashboard (8)
Model\BrowserTimeProvider.cs (5)
19private TimeZoneInfo? _browserLocalTimeZone; 29public override TimeZoneInfo LocalTimeZone 36if (string.IsNullOrEmpty(timeZone) || !TimeZoneInfo.TryFindSystemTimeZoneById(timeZone, out var timeZoneInfo)) 39timeZoneInfo = TimeZoneInfo.Utc;
src\Shared\TimeProviderExtensions.cs (3)
10var dateTime = TimeZoneInfo.ConvertTimeFromUtc(utcDateTimeOffset.UtcDateTime, timeProvider.LocalTimeZone); 18return TimeZoneInfo.ConvertTime(utcDateTimeOffset, timeProvider.LocalTimeZone); 32var local = TimeZoneInfo.ConvertTimeFromUtc(dateTime, timeProvider.LocalTimeZone);
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));
Aspire.Dashboard.Tests (2)
FormatHelpersTests.cs (2)
294public override TimeZoneInfo LocalTimeZone => TimeZoneInfo.Utc;
BlazorHosted.TimeApi (1)
Program.cs (1)
15return new TimeResponse(DateTimeOffset.UtcNow, TimeZoneInfo.Local.DisplayName);
BlazorStandalone.TimeApi (1)
Program.cs (1)
17return new TimeResponse(DateTimeOffset.UtcNow, TimeZoneInfo.Local.DisplayName);
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.Extensions.AI.Abstractions.Tests (24)
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);
Files\DelegatingHostedFileClientTests.cs (4)
185var expectedResult = TimeZoneInfo.Local; 189GetServiceCallback = (type, key) => type == typeof(TimeZoneInfo) && key == expectedKey 194var tzi = delegating.GetService(typeof(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);
TextToSpeech\DelegatingTextToSpeechClientTests.cs (4)
135var expectedResult = TimeZoneInfo.Local; 146var 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)
parent\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.Management (2)
System\Management\ManagementDateTime.cs (2)
201datetime = datetime.AddMinutes(-(utcOffset - TimeZoneInfo.Local.GetUtcOffset(datetime).Ticks / TimeSpan.TicksPerMinute)); 238TimeSpan tickOffset = date.Kind == DateTimeKind.Utc ? TimeSpan.Zero : TimeZoneInfo.Local.GetUtcOffset(date);
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\runtime\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; 235/// provided by <see cref="TimeProvider"/> which uses <see cref="DateTimeOffset.UtcNow"/>, <see cref="TimeZoneInfo.Local"/>, <see cref="Stopwatch"/>, and <see cref="Timer"/>.
src\runtime\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\runtime\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\runtime\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\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CultureInfo.cs (1)
763TimeZoneInfo.ClearCachedData();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (4)
866offset = TimeZoneInfo.GetLocalUtcOffset(DateTime.Now, TimeZoneInfoOptions.NoThrowOnInvalidTime); 874offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime); 927offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime); 1514offset = TimeZoneInfo.Local.GetUtcOffset(dateTime);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeParse.cs (6)
2806result.timeZoneOffset = TimeZoneInfo.GetLocalUtcOffset(result.parsedDate, TimeZoneInfoOptions.NoThrowOnInvalidTime); 2863result.timeZoneOffset = TimeZoneInfo.GetLocalUtcOffset(result.parsedDate, TimeZoneInfoOptions.NoThrowOnInvalidTime); 2944TimeZoneInfo tz = TimeZoneInfo.Local; 2976resultTicks += TimeZoneInfo.GetUtcOffsetFromUtc(utcDt, TimeZoneInfo.Local, out _, out isAmbiguousLocalDst).Ticks;
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (66)
34public sealed partial class TimeZoneInfo : IEquatable<TimeZoneInfo?>, ISerializable, IDeserializationCallback 54private List<TimeZoneInfo>? _equivalentZones; 60private static readonly TimeZoneInfo s_utcTimeZone = CreateUtcTimeZone(); 74private TimeZoneInfo? _localTimeZone; 76private TimeZoneInfo CreateLocal() 80TimeZoneInfo? timeZone = _localTimeZone; 104public TimeZoneInfo Local => _localTimeZone ?? CreateLocal(); 109public DateTimeKind GetCorrespondingKind(TimeZoneInfo? timeZone) 155public Dictionary<string, TimeZoneInfo>? _systemTimeZones; 159public ReadOnlyCollection<TimeZoneInfo>? _readOnlySystemTimeZones; 163public ReadOnlyCollection<TimeZoneInfo>? _readOnlyUnsortedSystemTimeZones; 166public Dictionary<string, TimeZoneInfo>? _timeZonesUsingAlternativeIds; 487/// Helper function for retrieving a <see cref="TimeZoneInfo"/> object by time zone name. 491/// This function will either return a valid <see cref="TimeZoneInfo"/> instance or 496/// <returns>Valid <see cref="TimeZoneInfo"/> instance.</returns> 497public static TimeZoneInfo FindSystemTimeZoneById(string id) 499TimeZoneInfo? value; 519/// Helper function for retrieving a <see cref="TimeZoneInfo"/> object by time zone name. 523/// This function will either return <c>true</c> and a valid <see cref="TimeZoneInfo"/> 527/// <param name="timeZoneInfo">A valid retrieved <see cref="TimeZoneInfo"/> or <c>null</c>.</param> 528/// <returns><c>true</c> if the <see cref="TimeZoneInfo"/> object was successfully retrieved, <c>false</c> otherwise.</returns> 529public static bool TryFindSystemTimeZoneById(string id, [NotNullWhenAttribute(true)] out TimeZoneInfo? timeZoneInfo) 538/// <c>TimeZoneInfoResult.Success</c> and a valid <see cref="TimeZoneInfo"/>instance and <c>null</c> Exception or 539/// <c>TimeZoneInfoResult.TimeZoneNotFoundException</c> and <c>null</c> <see cref="TimeZoneInfo"/> and Exception (can be null) or 540/// other <c>TimeZoneInfoResult</c> and <c>null</c> <see cref="TimeZoneInfo"/> and valid Exception. 542private static TimeZoneInfoResult TryFindSystemTimeZoneById(string id, out TimeZoneInfo? timeZone, out Exception? e) 598public static DateTimeOffset ConvertTime(DateTimeOffset dateTimeOffset, TimeZoneInfo destinationTimeZone) 618public static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo destinationTimeZone) 628TimeZoneInfo sourceTimeZone = dateTime.Kind == DateTimeKind.Utc ? s_utcTimeZone : cachedData.Local; 635public static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone) => 641internal static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags) => 644private static DateTime ConvertTime(DateTime dateTime, TimeZoneInfo sourceTimeZone, TimeZoneInfo destinationTimeZone, TimeZoneInfoOptions flags, CachedData cachedData) 707public static DateTime ConvertTimeFromUtc(DateTime dateTime, TimeZoneInfo destinationTimeZone) => 736public static DateTime ConvertTimeToUtc(DateTime dateTime, TimeZoneInfo sourceTimeZone) => 743public bool Equals([NotNullWhen(true)] TimeZoneInfo? other) => 748public override bool Equals([NotNullWhen(true)] object? obj) => Equals(obj as TimeZoneInfo); 750public static TimeZoneInfo FromSerializedString(string source) 770public static ReadOnlyCollection<TimeZoneInfo> GetSystemTimeZones() => GetSystemTimeZones(skipSorting: false); 779public static ReadOnlyCollection<TimeZoneInfo> GetSystemTimeZones(bool skipSorting) 787Dictionary<string, TimeZoneInfo>? filteredTimeZones = PopulateAllSystemTimeZones(cachedData); 793TimeZoneInfo[] array = new TimeZoneInfo[filteredTimeZones.Count]; 808cachedData._readOnlySystemTimeZones = cachedData._readOnlyUnsortedSystemTimeZones = new ReadOnlyCollection<TimeZoneInfo>(array); 812cachedData._readOnlyUnsortedSystemTimeZones = new ReadOnlyCollection<TimeZoneInfo>(array); 817cachedData._readOnlySystemTimeZones = cachedData._readOnlyUnsortedSystemTimeZones = ReadOnlyCollection<TimeZoneInfo>.Empty; 828public bool HasSameRules(TimeZoneInfo other) 855public static TimeZoneInfo Local => s_cachedData.Local; 881public static TimeZoneInfo Utc => s_utcTimeZone; 909public static TimeZoneInfo CreateCustomTimeZone( 933public static TimeZoneInfo CreateCustomTimeZone( 954public static TimeZoneInfo CreateCustomTimeZone( 1139private static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone) => 1146private static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings) => 1153internal static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings, out bool isAmbiguousLocalDst) 1163private static TimeZoneInfoResult TryGetTimeZone(string id, bool dstDisabled, out TimeZoneInfo? value, out Exception? e, CachedData cachedData, bool alwaysFallbackToLocalMachine = false) 1174TimeZoneInfo? zone = null; 1179value._equivalentZones = new List<TimeZoneInfo>(); 1187foreach (TimeZoneInfo tzi in value._equivalentZones) 1206cachedData._timeZonesUsingAlternativeIds ??= new Dictionary<string, TimeZoneInfo>(StringComparer.OrdinalIgnoreCase); 1218private static TimeZoneInfoResult TryGetTimeZoneUsingId(string id, bool dstDisabled, out TimeZoneInfo? value, out Exception? e, CachedData cachedData, bool alwaysFallbackToLocalMachine) 1283private static TimeZoneInfoResult TryGetTimeZoneFromLocalMachine(string id, bool dstDisabled, out TimeZoneInfo? value, out Exception? e, CachedData cachedData) 1293cachedData._systemTimeZones ??= new Dictionary<string, TimeZoneInfo>(StringComparer.OrdinalIgnoreCase) 1395private static TimeZoneInfo CreateUtcTimeZone()
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.StringSerializer.cs (2)
59public static unsafe string GetSerializedString(TimeZoneInfo zone) 146public static TimeZoneInfo GetDeserializedTimeZoneInfo(string source)
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (9)
287private static Dictionary<string, TimeZoneInfo> PopulateAllSystemTimeZones(CachedData cachedData) 291cachedData._systemTimeZones ??= new Dictionary<string, TimeZoneInfo>(StringComparer.OrdinalIgnoreCase) 304Dictionary<string, TimeZoneInfo> filteredTimeZones = new Dictionary<string, TimeZoneInfo>(capacity: initialCapacity, comparer: StringComparer.OrdinalIgnoreCase) 311if (TryGetTimeZone(timeZoneId, false, out TimeZoneInfo? timeZone, out _, cachedData, alwaysFallbackToLocalMachine: true) == TimeZoneInfoResult.Success && 327private static TimeZoneInfo GetLocalTimeZone(CachedData cachedData) 334private static TimeZoneInfoResult TryGetTimeZoneFromLocalMachine(string id, out TimeZoneInfo? value, out Exception? e) 339private static TimeZoneInfo? GetTimeZoneFromTzData(byte[]? rawData, string id) 368private static TimeZoneInfoResult TryGetTimeZone(string id, out TimeZoneInfo? timeZone, out Exception? e, CachedData cachedData)
src\runtime\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)
214TimeSpan utcOffset = TimeZoneInfo.Local.GetUtcOffset(dateTime); 444ticks += TimeZoneInfo.Local.GetUtcOffset(result).Ticks; 457ticks += TimeZoneInfo.Local.GetUtcOffset(result).Ticks; 505TimeSpan offset = TimeZoneInfo.Local.GetUtcOffset(dt);
System.Runtime (1)
src\runtime\artifacts\obj\System.Runtime\Release\net12.0\System.Runtime.Forwards.cs (1)
870[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.TimeZoneInfo))]