265 instantiations of TimeSpan
BinaryFormatTests (2)
dotnet-svcutil-lib (25)
FrameworkFork\Microsoft.Xml\Xml\schema\XsdDateTime.cs (9)
374return new DateTime(_dt.Subtract(new TimeSpan(ZoneHour, ZoneMinute, 0)).Ticks, DateTimeKind.Utc);
377return new DateTime(_dt.Add(new TimeSpan(ZoneHour, ZoneMinute, 0)).Ticks, DateTimeKind.Utc);
431ticks = result.Ticks - new TimeSpan(xdt.ZoneHour, xdt.ZoneMinute, 0).Ticks;
444ticks = result.Ticks + new TimeSpan(xdt.ZoneHour, xdt.ZoneMinute, 0).Ticks;
486result = new DateTimeOffset(dt, new TimeSpan(xdt.ZoneHour, xdt.ZoneMinute, 0));
489result = new DateTimeOffset(dt, new TimeSpan(-xdt.ZoneHour, -xdt.ZoneMinute, 0));
492result = new DateTimeOffset(dt, new TimeSpan(0));
697return _dt.Subtract(new TimeSpan(ZoneHour, ZoneMinute, 0));
699return _dt.Add(new TimeSpan(ZoneHour, ZoneMinute, 0));
FilesWebSite (2)
Controllers\DownloadFilesController.cs (2)
30var lastModified = new DateTimeOffset(year: 1999, month: 11, day: 04, hour: 3, minute: 0, second: 0, offset: new TimeSpan(0));
44var lastModified = new DateTimeOffset(year: 1999, month: 11, day: 04, hour: 3, minute: 0, second: 0, offset: new TimeSpan(0));
Microsoft.AspNetCore.Components.Endpoints.Tests (2)
Binding\FormDataMapperTests.cs (2)
2127{ "02:01:03", typeof(TimeSpan?), new TimeSpan?(new TimeSpan(02, 01, 03))},
2212{ "02:01:03", typeof(TimeSpan), new TimeSpan(02, 01, 03) },
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (2)
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
Microsoft.AspNetCore.Server.HttpSys (1)
Microsoft.Build (4)
Microsoft.Build.Engine.UnitTests (5)
Microsoft.Build.Framework (2)
Microsoft.Build.Tasks.UnitTests (3)
Microsoft.CodeAnalysis.Features (1)
Microsoft.Extensions.AI.Abstractions.Tests (1)
Microsoft.Extensions.Caching.Memory (1)
Microsoft.Extensions.Caching.StackExchangeRedis (1)
Microsoft.Extensions.Http (1)
Microsoft.Extensions.Http.Polly (1)
Microsoft.Gen.Logging.Generated.Tests (1)
Microsoft.Maui.Controls (1)
Microsoft.ML.Data (2)
Microsoft.ML.Tests (16)
Scenarios\Api\TestApi.cs (16)
423DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(1, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 0)
427DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(2, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 10)
431DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(1, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 10)
435DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(2, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 0)
439DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(3, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 20)
443DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(4, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 30)
447DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(3, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 30)
451DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(4, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 20)
Microsoft.Net.Http.Headers (1)
Microsoft.Net.Http.Headers.Tests (26)
MSBuildTaskHost (1)
PresentationCore (4)
PresentationCore.Tests (4)
System\Windows\DurationConverter.Tests.cs (4)
60yield return new object?[] { "17.22:10:15.4571230", CultureInfo.InvariantCulture, new Duration(new TimeSpan(17, 22, 10, 15, 457, 123)), true };
61yield return new object?[] { "17.22:10:15.4571230", new CultureInfo("ru-RU"), new Duration(new TimeSpan(17, 22, 10, 15, 457, 123)), true };
73Assert.Throws<ArgumentNullException>(() => converter.ConvertTo(new Duration(new TimeSpan(17, 22, 10, 15, 457, 123)), destinationType: null!));
88Assert.Throws<NotSupportedException>(() => converter.ConvertTo(null, null, new Duration(new TimeSpan(17, 22, 10, 15, 457, 123)), destinationType));
PresentationFramework (12)
Shared.Tests (1)
System.Data.Common (8)
System.Data.Odbc (2)
System.Diagnostics.DiagnosticSource (1)
System.Formats.Asn1 (5)
System.Formats.Nrbf (6)
System.Net.Http (5)
System.Net.Mail (10)
System\Net\Mime\SmtpDateTime.cs (10)
67{ "EDT", new TimeSpan(-4, 0, 0) }, // -0400
68{ "EST", new TimeSpan(-5, 0, 0) }, // -0500
69{ "CDT", new TimeSpan(-5, 0, 0) }, // -0500
70{ "CST", new TimeSpan(-6, 0, 0) }, // -0600
71{ "MDT", new TimeSpan(-6, 0, 0) }, // -0600
72{ "MST", new TimeSpan(-7, 0, 0) }, // -0700
73{ "PDT", new TimeSpan(-7, 0, 0) }, // -0700
74{ "PST", new TimeSpan(-8, 0, 0) }, // -0800
324timeZone = new TimeSpan(hours, minutes, 0);
340TimeSpan sanitizedTimeSpan = new TimeSpan(span.Days, span.Hours, span.Minutes, 0, 0);
System.Private.CoreLib (68)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\RuntimeEventSource.cs (8)
90_gen0GCCounter ??= new IncrementingPollingCounter("gen-0-gc-count", this, () => GC.CollectionCount(0)) { DisplayName = "Gen 0 GC Count", DisplayRateTimeScale = new TimeSpan(0, 1, 0) };
91_gen1GCCounter ??= new IncrementingPollingCounter("gen-1-gc-count", this, () => GC.CollectionCount(1)) { DisplayName = "Gen 1 GC Count", DisplayRateTimeScale = new TimeSpan(0, 1, 0) };
92_gen2GCCounter ??= new IncrementingPollingCounter("gen-2-gc-count", this, () => GC.CollectionCount(2)) { DisplayName = "Gen 2 GC Count", DisplayRateTimeScale = new TimeSpan(0, 1, 0) };
95_monitorContentionCounter ??= new IncrementingPollingCounter("monitor-lock-contention-count", this, () => Monitor.LockContentionCount) { DisplayName = "Monitor Lock Contention Count", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
97_completedItemsCounter ??= new IncrementingPollingCounter("threadpool-completed-items-count", this, () => ThreadPool.CompletedWorkItemCount) { DisplayName = "ThreadPool Completed Work Item Count", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
98_allocRateCounter ??= new IncrementingPollingCounter("alloc-rate", this, () => GC.GetTotalAllocatedBytes()) { DisplayName = "Allocation Rate", DisplayUnits = "B", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
106_exceptionCounter ??= new IncrementingPollingCounter("exception-count", this, () => Exception.GetExceptionCount()) { DisplayName = "Exception Count", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
118_jitTimeCounter ??= new IncrementingPollingCounter("time-in-jit", this, () => Runtime.JitInfo.GetCompilationTime().TotalMilliseconds) { DisplayName = "Time spent in JIT", DisplayUnits = "ms", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (6)
118_baseUtcOffset = new TimeSpan(_baseUtcOffset.Hours, _baseUtcOffset.Minutes, 0);
658result = new TimeSpan(result.Hours, result.Minutes, 0);
727daylightSavingsTimeSpan = new TimeSpan(1, 0, 0);
789result = new TimeSpan(hours, 0, 0);
819timeOffset = new TimeSpan(timeOffset.GetValueOrDefault().Hours, timeOffset.GetValueOrDefault().Minutes, timeOffset.GetValueOrDefault().Seconds);
1306UtcOffset = new TimeSpan(0, 0, TZif_ToInt32(data, index + 00));
System.Private.DataContractSerialization (4)
System.Private.Windows.Core (2)
System.Private.Xml (12)
System\Xml\Schema\XsdDateTime.cs (7)
358XsdDateTimeKind.LocalEastOfZulu => new DateTime(_dt.Subtract(new TimeSpan(ZoneHour, ZoneMinute, 0)).Ticks, DateTimeKind.Utc),
359XsdDateTimeKind.LocalWestOfZulu => new DateTime(_dt.Add(new TimeSpan(ZoneHour, ZoneMinute, 0)).Ticks, DateTimeKind.Utc),
412ticks = result.Ticks - new TimeSpan(xdt.ZoneHour, xdt.ZoneMinute, 0).Ticks;
425ticks = result.Ticks + new TimeSpan(xdt.ZoneHour, xdt.ZoneMinute, 0).Ticks;
467result = new DateTimeOffset(dt, new TimeSpan(xdt.ZoneHour, xdt.ZoneMinute, 0));
470result = new DateTimeOffset(dt, new TimeSpan(-xdt.ZoneHour, -xdt.ZoneMinute, 0));
473result = new DateTimeOffset(dt, new TimeSpan(0));
System.Resources.Extensions (2)
System.Runtime.Caching (9)
System.Text.Json (1)
System.Text.RegularExpressions (1)
System.Threading.RateLimiting (1)
System.Transactions.Local (2)
System.Windows.Controls.Ribbon (2)
11048 references to TimeSpan
AnalyzerRunner (2)
aspire (7)
Aspire.Azure.AI.OpenAI.Tests (2)
Aspire.Cli.Tests (14)
Aspire.Components.Common.TestUtilities (1)
Aspire.Confluent.Kafka (19)
Aspire.Confluent.Kafka.Tests (2)
Aspire.Dashboard (67)
Components\Pages\Metrics.razor.cs (13)
22private List<SelectViewModel<TimeSpan>> _durations = null!;
23private static readonly TimeSpan s_defaultDuration = TimeSpan.FromMinutes(5);
83_durations = new List<SelectViewModel<TimeSpan>>
85new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastOneMinute)], Id = TimeSpan.FromMinutes(1) },
86new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastFiveMinutes)], Id = TimeSpan.FromMinutes(5) },
87new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastFifteenMinutes)], Id = TimeSpan.FromMinutes(15) },
88new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastThirtyMinutes)], Id = TimeSpan.FromMinutes(30) },
89new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastHour)], Id = TimeSpan.FromHours(1) },
90new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastThreeHours)], Id = TimeSpan.FromHours(3) },
91new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastSixHours)], Id = TimeSpan.FromHours(6) },
92new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastTwelveHours)], Id = TimeSpan.FromHours(12) },
251public SelectViewModel<TimeSpan> SelectedDuration { get; set; } = null!;
Otlp\Model\DurationFormatter.cs (8)
20new UnitStep { Unit = "d", Ticks = TimeSpan.TicksPerDay },
21new UnitStep { Unit = "h", Ticks = TimeSpan.TicksPerHour },
22new UnitStep { Unit = "m", Ticks = TimeSpan.TicksPerMinute },
23new UnitStep { Unit = "s", Ticks = TimeSpan.TicksPerSecond, IsDecimal = true },
24new UnitStep { Unit = "ms", Ticks = TimeSpan.TicksPerMillisecond, IsDecimal = true },
25new UnitStep { Unit = "μs", Ticks = TimeSpan.TicksPerMicrosecond, IsDecimal = true },
28public static string FormatDuration(TimeSpan duration)
48public static string GetUnit(TimeSpan duration)
ServiceClient\DashboardClient.cs (9)
122KeepAlivePingDelay = TimeSpan.FromSeconds(20),
123KeepAlivePingTimeout = TimeSpan.FromSeconds(10),
155InitialBackoff = TimeSpan.FromSeconds(1),
156MaxBackoff = TimeSpan.FromSeconds(5),
314var delay = ExponentialBackOff(retryContext.ErrorCount, maxSeconds: 15);
340static TimeSpan ExponentialBackOff(int errorCount, double maxSeconds)
342return TimeSpan.FromSeconds(Math.Min(Math.Pow(2, errorCount - 1), maxSeconds));
581await foreach (var batch in channel.GetBatchesAsync(minReadInterval: TimeSpan.FromMilliseconds(100), cancellationToken: enumeratorCancellationToken).ConfigureAwait(false))
675await foreach (var batch in channel.GetBatchesAsync(TimeSpan.FromMilliseconds(100), combinedTokens.Token).ConfigureAwait(false))
Aspire.Dashboard.Components.Tests (28)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Dashboard.Tests (63)
DurationFormatterTests.cs (27)
23Assert.Equal(unit, DurationFormatter.GetUnit(TimeSpan.FromTicks(ticks)));
29Assert.Equal("1μs", DurationFormatter.FormatDuration(TimeSpan.FromTicks(1 * TimeSpan.TicksPerMicrosecond)));
35var input = 10 * TimeSpan.TicksPerDay + 13 * TimeSpan.TicksPerHour + 30 * TimeSpan.TicksPerMinute;
36Assert.Equal("10d 14h", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
42var input = 2 * TimeSpan.TicksPerDay + 5 * TimeSpan.TicksPerMinute;
43Assert.Equal("2d", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
49var input = 2 * TimeSpan.TicksPerMillisecond + 357 * TimeSpan.TicksPerMicrosecond;
50Assert.Equal(2.36m.ToString("0.##ms", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
56var input = 2 * TimeSpan.TicksPerSecond + 357 * TimeSpan.TicksPerMillisecond;
57Assert.Equal(2.36m.ToString("0.##s", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
63var input = 2 * TimeSpan.TicksPerMinute + 30 * TimeSpan.TicksPerSecond + 555 * TimeSpan.TicksPerMillisecond;
64Assert.Equal("2m 31s", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
70var input = 2 * TimeSpan.TicksPerHour + 30 * TimeSpan.TicksPerMinute + 30 * TimeSpan.TicksPerSecond;
71Assert.Equal("2h 31m", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
77var input = (double)TimeSpan.TicksPerMicrosecond / 10;
78Assert.Equal(0.1m.ToString("0.##μs", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks((long)input)));
85Assert.Equal("0μs", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.EndToEnd.Tests (15)
Aspire.Hosting (47)
Aspire.Hosting.Azure (5)
Aspire.Hosting.Azure.ServiceBus (7)
Aspire.Hosting.Azure.Sql (4)
Aspire.Hosting.Azure.Tests (47)
Aspire.Hosting.Containers.Tests (3)
Aspire.Hosting.Docker.Tests (1)
Aspire.Hosting.Garnet (7)
Aspire.Hosting.Garnet.Tests (8)
Aspire.Hosting.Kafka.Tests (23)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.MongoDB.Tests (9)
Aspire.Hosting.MySql.Tests (29)
MySqlFunctionalTests.cs (11)
71.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2), ShouldHandle = new PredicateBuilder().Handle<MySqlException>() })
125.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
302.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2), ShouldHandle = new PredicateBuilder().Handle<MySqlException>() })
389.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2), ShouldHandle = new PredicateBuilder().Handle<MySqlException>() })
473.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(1), ShouldHandle = new PredicateBuilder().Handle<MySqlException>() })
615var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
617.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
689var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
691.AddRetry(new() { MaxRetryAttempts = 3, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
764var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
814var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.Nats.Tests (3)
Aspire.Hosting.NodeJs.Tests (19)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.Oracle.Tests (8)
Aspire.Hosting.PostgreSQL.Tests (33)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.Python.Tests (3)
Aspire.Hosting.Qdrant.Tests (5)
Aspire.Hosting.RabbitMQ.Tests (19)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.Redis (6)
Aspire.Hosting.Redis.Tests (8)
Aspire.Hosting.SqlServer.Tests (12)
SqlServerFunctionalTests.cs (12)
25var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
65var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
67.AddRetry(new() { MaxRetryAttempts = int.MaxValue, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
130var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
132.AddRetry(new() { MaxRetryAttempts = int.MaxValue, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
338var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
340.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
404var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
406.AddRetry(new() { MaxRetryAttempts = 3, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
457var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
459.AddRetry(new() { MaxRetryAttempts = 3, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
533var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.Testing (5)
Aspire.Hosting.Testing.Tests (23)
Aspire.Hosting.Tests (63)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Utils\PeriodicRestartAsyncEnumerableTests.cs (10)
16cts.CancelAfter(TimeSpan.FromSeconds(1));
21var innerFactory = (int? lastValue, CancellationToken cancellationToken) => Task.FromResult(CountingAsyncEnumerable(0, TimeSpan.FromMilliseconds(50), cancellationToken));
23await foreach (var _ in PeriodicRestartAsyncEnumerable.CreateAsync(innerFactory, restartInterval: TimeSpan.FromSeconds(2), cancellationToken: cts.Token).ConfigureAwait(false))
25if (DateTime.UtcNow - start > TimeSpan.FromSeconds(2))
40cts.CancelAfter(TimeSpan.FromSeconds(1));
44var innerFactory = (int? lastValue, CancellationToken cancellationToken) => Task.FromResult(RefCountingAsyncEnumerable(0, TimeSpan.FromMilliseconds(10), cancellationToken));
46await foreach (var _ in PeriodicRestartAsyncEnumerable.CreateAsync(innerFactory, restartInterval: TimeSpan.FromMilliseconds(100), cancellationToken: cts.Token).ConfigureAwait(false))
48if (DateTime.UtcNow - start > TimeSpan.FromSeconds(2))
59static async IAsyncEnumerable<int> CountingAsyncEnumerable(int start, TimeSpan delay, [EnumeratorCancellation] CancellationToken cancellationToken)
71static async IAsyncEnumerable<int> RefCountingAsyncEnumerable(int start, TimeSpan delay, [EnumeratorCancellation] CancellationToken cancellationToken)
Aspire.Hosting.Valkey (6)
Aspire.Hosting.Valkey.Tests (21)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.Yarp.Tests (8)
Aspire.Microsoft.EntityFrameworkCore.Cosmos (1)
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (13)
Aspire.MongoDB.Driver (1)
Aspire.NATS.Net.Tests (1)
Aspire.Playground.Tests (27)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Pomelo.EntityFrameworkCore.MySql (2)
Aspire.Qdrant.Client (1)
Aspire.RabbitMQ.Client (1)
Aspire.RabbitMQ.Client.Tests (2)
Aspire.RabbitMQ.Client.v7.Tests (2)
Aspire.StackExchange.Redis (3)
Aspire.StackExchange.Redis.DistributedCaching.Tests (2)
Aspire.StackExchange.Redis.OutputCaching.Tests (2)
Aspire.StackExchange.Redis.Tests (3)
Aspire.Templates.Tests (19)
AuthSamples.FunctionalTests (4)
CustomPolicyProviderTests.cs (4)
51var signIn = await SignIn(Client, "Dude", DateTime.Now.Subtract(TimeSpan.FromDays(365 * 20)).ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern, CultureInfo.InvariantCulture));
67var signIn = await SignIn(Client, "Dude", DateTime.Now.Subtract(TimeSpan.FromDays(365 * 5)).ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern, CultureInfo.InvariantCulture));
82var signIn = await SignIn(Client, "Dude", DateTime.Now.Subtract(TimeSpan.FromDays(365 * 55)).ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern, CultureInfo.InvariantCulture));
98var signIn = await SignIn(Client, "Dude", DateTime.Now.Subtract(TimeSpan.FromDays(365 * 20)).ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern, CultureInfo.InvariantCulture));
AzureSearch.ApiService (1)
BasicWebSite (2)
BinaryFormatTests (7)
Binding.Http.IntegrationTests (2)
Binding.ReliableSession.IntegrationTests (4)
Binding.Tcp.IntegrationTests (5)
CdkSample.AppHost (2)
Client.ChannelLayer.IntegrationTests (3)
Client.ClientBase.IntegrationTests (2)
Client.ExpectedExceptions.IntegrationTests (15)
Client.TypedClient.IntegrationTests (3)
ConfigurationSchemaGenerator (1)
ConfigurationSchemaGenerator.Tests (7)
Consumer (1)
Contract.Service.IntegrationTests (8)
CookieSample (1)
CookieSessionSample (1)
CosmosEndToEnd.ApiService (1)
CustomResources.AppHost (1)
dotnet-dev-certs (4)
dotnet-getdocument (1)
dotnet-openapi (1)
dotnet-svcutil-lib (1310)
FrameworkFork\Microsoft.Xml\Xml\schema\FacetChecker.cs (17)
830internal virtual Exception CheckValueFacets(TimeSpan value, XmlSchemaDatatype datatype)
1212TimeSpan timeSpanValue = (TimeSpan)datatype.ValueConverter.ChangeType(value, typeof(TimeSpan));
1216internal override Exception CheckValueFacets(TimeSpan value, XmlSchemaDatatype datatype)
1223if (TimeSpan.Compare(value, (TimeSpan)restriction.MaxInclusive) > 0)
1231if (TimeSpan.Compare(value, (TimeSpan)restriction.MaxExclusive) >= 0)
1239if (TimeSpan.Compare(value, (TimeSpan)restriction.MinInclusive) < 0)
1247if (TimeSpan.Compare(value, (TimeSpan)restriction.MinExclusive) <= 0)
1263return MatchEnumeration((TimeSpan)value, enumeration);
1266private bool MatchEnumeration(TimeSpan value, ArrayList enumeration)
1270if (TimeSpan.Compare(value, (TimeSpan)enumeration[i]) == 0)
FrameworkFork\System.Runtime.Serialization\System\Xml\ArrayHelper.cs (6)
368internal class TimeSpanArrayHelperWithString : ArrayHelper<string, TimeSpan>
372protected override int ReadArray(XmlDictionaryReader reader, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
377protected override void WriteArray(XmlDictionaryWriter writer, string prefix, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
383internal class TimeSpanArrayHelperWithDictionaryString : ArrayHelper<XmlDictionaryString, TimeSpan>
387protected override int ReadArray(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
392protected override void WriteArray(XmlDictionaryWriter writer, string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryReader.cs (6)
238public override TimeSpan ReadElementContentAsTimeSpan()
245TimeSpan value = BufferReader.ReadTimeSpan();
1173type = typeof(TimeSpan);
1498private int ReadArray(TimeSpan[] array, int offset, int count)
1510public override int ReadArray(string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
1517public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryWriter.cs (5)
897public override void WriteTimeSpanText(TimeSpan value)
972public void WriteTimeSpanArray(TimeSpan[] array, int offset, int count)
1214else if (type == typeof(TimeSpan))
1609public override void WriteArray(string prefix, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
1622public override void WriteArray(string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryAsyncCheckWriter.cs (3)
375public override void WriteValue(TimeSpan value)
516public override void WriteArray(string prefix, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
522public override void WriteArray(string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryReader.cs (7)
561public virtual TimeSpan ReadContentAsTimeSpan()
813public virtual TimeSpan ReadElementContentAsTimeSpan()
816TimeSpan value;
1173public virtual TimeSpan[] ReadTimeSpanArray(string localName, string namespaceUri)
1178public virtual TimeSpan[] ReadTimeSpanArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri)
1183public virtual int ReadArray(string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
1195public virtual int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryWriter.cs (5)
184public virtual void WriteValue(TimeSpan value)
276else if (type == typeof(TimeSpan))
305else if (type == typeof(TimeSpan))
571public virtual void WriteArray(string prefix, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
582public virtual void WriteArray(string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
FrameworkFork\System.ServiceModel\Internals\System\Runtime\InputQueue.cs (17)
75public IAsyncResult BeginDequeue(TimeSpan timeout, AsyncCallback callback, object state)
113public IAsyncResult BeginWaitForItem(TimeSpan timeout, AsyncCallback callback, object state)
146public T Dequeue(TimeSpan timeout)
159public bool Dequeue(TimeSpan timeout, out T value)
392public bool WaitForItem(TimeSpan timeout)
804public AsyncQueueReader(InputQueue<T> inputQueue, TimeSpan timeout, AsyncCallback callback, object state)
812if (timeout != TimeSpan.MaxValue)
814_timer = new Timer(new TimerCallback(s_timerCallback), this, timeout, TimeSpan.FromMilliseconds(-1));
840_timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
867public AsyncQueueWaiter(TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
869if (timeout != TimeSpan.MaxValue)
871_timer = new Timer(new TimerCallback(s_timerCallback), this, timeout, TimeSpan.FromMilliseconds(-1));
896timely = (_timer == null) || _timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
1031public bool Wait(TimeSpan timeout, out T value)
1093public bool Wait(TimeSpan timeout)
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TimeoutHelper.cs (47)
14public static readonly TimeSpan MaxWait = TimeSpan.FromMilliseconds(Int32.MaxValue);
22private TimeSpan _originalTimeout;
24public TimeoutHelper(TimeSpan timeout)
26Contract.Assert(timeout >= TimeSpan.Zero, "timeout must be non-negative");
31_deadlineSet = (timeout == TimeSpan.MaxValue);
43var timeout = RemainingTime();
48else if (timeout > TimeSpan.Zero)
63public TimeSpan OriginalTimeout
68public static bool IsTooLarge(TimeSpan timeout)
70return (timeout > TimeoutHelper.MaxWait) && (timeout != TimeSpan.MaxValue);
73public static TimeSpan FromMilliseconds(int milliseconds)
77return TimeSpan.MaxValue;
81return TimeSpan.FromMilliseconds(milliseconds);
85public static int ToMilliseconds(TimeSpan timeout)
87if (timeout == TimeSpan.MaxValue)
94if (ticks / TimeSpan.TicksPerMillisecond > int.MaxValue)
102public static TimeSpan Min(TimeSpan val1, TimeSpan val2)
114public static TimeSpan Add(TimeSpan timeout1, TimeSpan timeout2)
119public static DateTime Add(DateTime time, TimeSpan timeout)
121if (timeout >= TimeSpan.Zero && DateTime.MaxValue - time <= timeout)
125if (timeout <= TimeSpan.Zero && DateTime.MinValue - time >= timeout)
132public static DateTime Subtract(DateTime time, TimeSpan timeout)
134return Add(time, TimeSpan.Zero - timeout);
137public static TimeSpan Divide(TimeSpan timeout, int factor)
139if (timeout == TimeSpan.MaxValue)
141return TimeSpan.MaxValue;
147public TimeSpan RemainingTime()
156return TimeSpan.MaxValue;
160TimeSpan remaining = _deadline - DateTime.UtcNow;
161if (remaining <= TimeSpan.Zero)
163return TimeSpan.Zero;
172public TimeSpan ElapsedTime()
184public static void ThrowIfNegativeArgument(TimeSpan timeout)
189public static void ThrowIfNegativeArgument(TimeSpan timeout, string argumentName)
191if (timeout < TimeSpan.Zero)
197public static void ThrowIfNonPositiveArgument(TimeSpan timeout)
202public static void ThrowIfNonPositiveArgument(TimeSpan timeout, string argumentName)
204if (timeout <= TimeSpan.Zero)
210public static bool WaitOne(WaitHandle waitHandle, TimeSpan timeout)
213if (timeout == TimeSpan.MaxValue)
226internal static TimeoutException CreateEnterTimedOutException(TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\BufferedConnection.cs (26)
19private TimeSpan _flushTimeout;
20private TimeSpan _pendingTimeout;
23public BufferedConnection(IConnection connection, TimeSpan flushTimeout, int writeBufferSize)
35public override void Close(TimeSpan timeout, bool asyncAndLinger)
46_flushTimer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
47_pendingTimeout = TimeSpan.Zero;
51private void Flush(TimeSpan timeout)
61private void FlushCore(TimeSpan timeout)
77_pendingTimeout = TimeSpan.Zero;
96_flushTimer = new Timer(new TimerCallback(new Action<object>(OnFlushTimer)), null, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
99_flushTimer.Change(_flushTimeout, TimeSpan.FromMilliseconds(-1));
102public override void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager)
111if (immediate || _flushTimeout == TimeSpan.Zero)
122public override void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
131if (immediate || _flushTimeout == TimeSpan.Zero)
141private void WriteNow(byte[] buffer, int offset, int size, TimeSpan timeout)
146private void WriteNow(byte[] buffer, int offset, int size, TimeSpan timeout, BufferManager bufferManager)
184private void WriteLater(byte[] buffer, int offset, int size, TimeSpan timeout)
238public override AsyncCompletionResult BeginWrite(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, Action<object> callback, object state)
270private TimeSpan _flushTimeout;
273public BufferedConnectionInitiator(IConnectionInitiator connectionInitiator, TimeSpan flushTimeout, int writeBufferSize)
280protected TimeSpan FlushTimeout
296public IConnection Connect(Uri uri, TimeSpan timeout)
301public async Task<IConnection> ConnectAsync(Uri uri, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ChainedAsyncResult.cs (9)
10internal delegate IAsyncResult ChainedBeginHandler(TimeSpan timeout, AsyncCallback asyncCallback, object state);
22protected ChainedAsyncResult(TimeSpan timeout, AsyncCallback callback, object state)
28public ChainedAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, ChainedBeginHandler begin2, ChainedEndHandler end2)
132public ChainedCloseAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, IList<ICommunicationObject> collection)
140public ChainedCloseAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, params ICommunicationObject[] objs)
152private IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
167public ChainedOpenAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, IList<ICommunicationObject> collection)
175public ChainedOpenAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, params ICommunicationObject[] objs)
187private IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CommunicationObject.cs (28)
67protected abstract TimeSpan DefaultCloseTimeout { get; }
68protected abstract TimeSpan DefaultOpenTimeout { get; }
70internal TimeSpan InternalCloseTimeout
75internal TimeSpan InternalOpenTimeout
121public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
131public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
141public void Close(TimeSpan timeout)
146private async Task CloseAsyncInternal(TimeSpan timeout)
152async Task IAsyncCommunicationObject.CloseAsync(TimeSpan timeout)
154if (timeout < TimeSpan.Zero)
316public void Open(TimeSpan timeout)
321private async Task OpenAsyncInternal(TimeSpan timeout)
327async Task IAsyncCommunicationObject.OpenAsync(TimeSpan timeout)
329if (timeout < TimeSpan.Zero)
348TimeSpan remainingTime = actualTimeout.RemainingTime();
746protected abstract void OnClose(TimeSpan timeout);
748protected abstract IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state);
752protected abstract void OnOpen(TimeSpan timeout);
754protected abstract IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state);
758internal protected virtual Task OnCloseAsync(TimeSpan timeout)
764internal protected virtual Task OnOpenAsync(TimeSpan timeout)
798public static TimeSpan GetInternalCloseTimeout(this CommunicationObject communicationObject)
803public static void OnClose(CommunicationObject communicationObject, TimeSpan timeout)
808public static IAsyncResult OnBeginClose(CommunicationObject communicationObject, TimeSpan timeout, AsyncCallback callback, object state)
818public static void OnOpen(CommunicationObject communicationObject, TimeSpan timeout)
823public static IAsyncResult OnBeginOpen(CommunicationObject communicationObject, TimeSpan timeout, AsyncCallback callback, object state)
828public static async Task OnCloseAsyncInternal(CommunicationObject communicationObject, TimeSpan timeout)
834public static async Task OnOpenAsyncInternal(CommunicationObject communicationObject, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\Connection.cs (31)
22void Close(TimeSpan timeout, bool asyncAndLinger);
24AsyncCompletionResult BeginWrite(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout,
27void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout);
28void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager);
30int Read(byte[] buffer, int offset, int size, TimeSpan timeout);
31AsyncCompletionResult BeginRead(int offset, int size, TimeSpan timeout, Action<object> callback, object state);
38IConnection Connect(Uri uri, TimeSpan timeout);
39Task<IConnection> ConnectAsync(Uri uri, TimeSpan timeout);
72public virtual void Close(TimeSpan timeout, bool asyncAndLinger)
77public virtual AsyncCompletionResult BeginWrite(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout,
88public virtual void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
93public virtual void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager)
98public virtual int Read(byte[] buffer, int offset, int size, TimeSpan timeout)
103public virtual AsyncCompletionResult BeginRead(int offset, int size, TimeSpan timeout,
154public override int Read(byte[] buffer, int offset, int size, TimeSpan timeout)
170public override AsyncCompletionResult BeginRead(int offset, int size, TimeSpan timeout, Action<object> callback, object state)
202private TimeSpan _closeTimeout;
244public TimeSpan CloseTimeout
426protected int Read(byte[] buffer, int offset, int count, TimeSpan timeout)
536public void Close(TimeSpan timeout, bool asyncAndLinger)
549public AsyncCompletionResult BeginWrite(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout,
614public void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
628public void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager)
634private void SetReadTimeout(TimeSpan timeout)
644private void SetWriteTimeout(TimeSpan timeout)
654public int Read(byte[] buffer, int offset, int size, TimeSpan timeout)
667public AsyncCompletionResult BeginRead(int offset, int size, TimeSpan timeout, Action<object> callback, object state)
744internal static void CloseNoThrow(IConnection connection, TimeSpan timeout)
814internal static async Task WriteAsync(this IConnection connection, byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
828internal static async Task<int> ReadAsync(this IConnection connection, int offset, int size, TimeSpan timeout)
846internal static async Task<int> ReadAsync(this IConnection connection, byte[] buffer, int offset, int size, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ConnectionPool.cs (19)
47protected abstract void CloseItem(TItem item, TimeSpan timeout);
48protected abstract void CloseItemAsync(TItem item, TimeSpan timeout);
57public bool Close(TimeSpan timeout)
120private EndpointConnectionPool GetEndpointPool(TKey key, TimeSpan timeout)
169private void OnClose(TimeSpan timeout)
193public void AddConnection(TKey key, TItem connection, TimeSpan timeout)
200public TItem TakeConnection(EndpointAddress address, Uri via, TimeSpan timeout, out TKey key)
208public void ReturnConnection(TKey key, TItem connection, bool connectionIsStillGood, TimeSpan timeout)
295protected virtual void CloseItem(TItem item, TimeSpan timeout)
300protected virtual void CloseItemAsync(TItem item, TimeSpan timeout)
325public void Close(TimeSpan timeout)
384public void AddConnection(TItem connection, TimeSpan timeout)
417public TItem TakeConnection(TimeSpan timeout)
471public void ReturnConnection(TItem connection, bool connectionIsStillGood, TimeSpan timeout)
509public void CloseIdleConnection(TItem connection, TimeSpan timeout)
602private TimeSpan _maxOutputDelay;
605protected ConnectionPool(IConnectionOrientedTransportChannelFactorySettings settings, TimeSpan leaseTimeout)
623protected override void CloseItem(IConnection item, TimeSpan timeout)
628protected override void CloseItemAsync(IConnection item, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ConnectionPoolHelper.cs (12)
46protected abstract TimeoutException CreateNewConnectionTimeoutException(TimeSpan timeout, TimeoutException innerException);
48private IConnection TakeConnection(TimeSpan timeout)
53public async Task<IConnection> EstablishConnectionAsync(TimeSpan timeout)
90_connectionPool.ReturnConnection(_connectionKey, localRawConnection, false, TimeSpan.Zero);
100TimeSpan connectTimeout = timeoutHelper.RemainingTime();
135public IConnection EstablishConnection(TimeSpan timeout)
172_connectionPool.ReturnConnection(_connectionKey, localRawConnection, false, TimeSpan.Zero);
182TimeSpan connectTimeout = timeoutHelper.RemainingTime();
228_connectionPool.ReturnConnection(_connectionKey, rawConnection, false, TimeSpan.Zero);
246ReleaseConnection(true, TimeSpan.Zero);
249public void Close(TimeSpan timeout)
254private void ReleaseConnection(bool abort, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CoreClrSocketConnection.cs (31)
30private TimeSpan _readFinTimeout;
51_sendTimeout = _receiveTimeout = TimeSpan.MaxValue;
65_sendTimer = new Timer(s_onSendTimeout, this, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
83_receiveTimer = new Timer(s_onReceiveTimeout, this, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
221_receiveTimer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
229_sendTimer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
311private void ContinueClose(TimeSpan timeout)
341protected override void ShutdownCore(TimeSpan timeout)
351ConvertSendException(socketException, TimeSpan.MaxValue));
367protected override AsyncCompletionResult BeginWriteCore(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout,
403ConvertSendException(socketException, TimeSpan.MaxValue));
464_asyncWriteException = ConvertSendException(socketException, TimeSpan.MaxValue);
519protected override void WriteCore(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
577protected override int ReadCore(byte[] buffer, int offset, int size, TimeSpan timeout, bool closing)
626protected override AsyncCompletionResult BeginReadCore(int offset, int size, TimeSpan timeout,
664throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(ConvertReceiveException(socketException, TimeSpan.MaxValue));
704_asyncReadException = ConvertReceiveException(socketException, TimeSpan.MaxValue);
793private void SetReadTimeout(TimeSpan timeout, bool synchronous, bool closing)
800if (timeout <= TimeSpan.Zero)
822if (timeout == TimeSpan.MaxValue)
828ReceiveTimer.Change(timeout, TimeSpan.FromMilliseconds(-1));
833private void SetWriteTimeout(TimeSpan timeout, bool synchronous)
840if (timeout <= TimeSpan.Zero)
859if (timeout == TimeSpan.MaxValue)
865SendTimer.Change(timeout, TimeSpan.FromMilliseconds(-1));
870private bool UpdateTimeout(TimeSpan oldTimeout, TimeSpan newTimeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\FramingChannels.cs (15)
52protected override void CloseOutputSessionCore(TimeSpan timeout)
57protected override Task CloseOutputSessionCoreAsync(TimeSpan timeout)
62protected override void CompleteClose(TimeSpan timeout)
76protected override void OnSendCore(Message message, TimeSpan timeout)
88protected override AsyncCompletionResult BeginCloseOutput(TimeSpan timeout, Action<object> callback, object state)
99protected override AsyncCompletionResult StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout, Action<object> callback, object state)
105protected override AsyncCompletionResult StartWritingStreamedMessage(Message message, TimeSpan timeout, Action<object> callback, object state)
219protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
241private async Task<IConnection> SendPreambleAsync(IConnection connection, ArraySegment<byte> preamble, TimeSpan timeout)
315protected internal override async Task OnOpenAsync(TimeSpan timeout)
343protected override void OnOpen(TimeSpan timeout)
371protected override void ReturnConnectionIfNecessary(bool abort, TimeSpan timeout)
425protected override TimeoutException CreateNewConnectionTimeoutException(TimeSpan timeout, TimeoutException innerException)
447Uri via, string contentType, TimeSpan timeout)
560ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelFactory.cs (15)
362private SecurityTokenProviderContainer CreateAndOpenTokenProvider(TimeSpan timeout, AuthenticationSchemes authenticationScheme,
480protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
490protected override void OnOpen(TimeSpan timeout)
504internal protected override Task OnOpenAsync(TimeSpan timeout)
510protected internal override Task OnCloseAsync(TimeSpan timeout)
646private void CreateAndOpenTokenProvidersCore(EndpointAddress to, Uri via, ChannelParameterCollection channelParameters, TimeSpan timeout, out SecurityTokenProviderContainer tokenProvider)
652internal void CreateAndOpenTokenProviders(EndpointAddress to, Uri via, ChannelParameterCollection channelParameters, TimeSpan timeout, out SecurityTokenProviderContainer tokenProvider)
729private void CreateAndOpenTokenProviders(TimeSpan timeout)
738private void CloseTokenProviders(TimeSpan timeout)
755protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
765protected override void OnOpen(TimeSpan timeout)
770internal protected override Task OnOpenAsync(TimeSpan timeout)
788protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
798protected override void OnClose(TimeSpan timeout)
803protected internal override async Task OnCloseAsync(TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\IdlingCommunicationPool.cs (18)
18private TimeSpan _idleTimeout;
19private TimeSpan _leaseTimeout;
21protected IdlingCommunicationPool(int maxCount, TimeSpan idleTimeout, TimeSpan leaseTimeout)
28public TimeSpan IdleTimeout
33protected TimeSpan LeaseTimeout
38protected override void CloseItemAsync(TItem item, TimeSpan timeout)
46if (_idleTimeout != TimeSpan.MaxValue || _leaseTimeout != TimeSpan.MaxValue)
77protected override void CloseItemAsync(TItem item, TimeSpan timeout)
83protected override void CloseItem(TItem item, TimeSpan timeout)
104private TimeSpan _idleTimeout;
105private TimeSpan _leaseTimeout;
185_idleTimer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
200_idleTimer = new Timer(new TimerCallback(new Action<object>(s_onIdle)), this, _idleTimeout, TimeSpan.FromMilliseconds(-1));
204_idleTimer.Change(_idleTimeout, TimeSpan.FromMilliseconds(-1));
285_idleTimer.Change(_idleTimeout, TimeSpan.FromMilliseconds(-1));
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\LayeredChannelFactory.cs (16)
40protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
50protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
60protected override void OnClose(TimeSpan timeout)
67protected override void OnOpen(TimeSpan timeout)
110public Message Receive(TimeSpan timeout)
122public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
134public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
146public bool TryReceive(TimeSpan timeout, out Message message)
153public bool WaitForMessage(TimeSpan timeout)
158public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
211protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
221protected override void OnClose(TimeSpan timeout)
228protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
238protected override void OnOpen(TimeSpan timeout)
250public void Send(Message message, TimeSpan timeout)
260public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\LifetimeManager.cs (19)
69public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
80public void Close(TimeSpan timeout)
92private CommunicationWaitResult CloseCore(TimeSpan timeout, bool aborting)
189CloseCore(TimeSpan.FromSeconds(1), true);
192protected virtual IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
225protected virtual void OnClose(TimeSpan timeout)
267CommunicationWaitResult Wait(TimeSpan timeout, bool aborting);
276private TimeSpan _timeout;
278public CloseCommunicationAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, object mutex)
285if (timeout < TimeSpan.Zero)
288_timer = new Timer(new TimerCallback(new Action<object>(TimeoutCallback)), this, timeout, TimeSpan.FromMilliseconds(-1));
313_timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
334public CommunicationWaitResult Wait(TimeSpan timeout, bool aborting)
336if (timeout < TimeSpan.Zero)
352_timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
400public CommunicationWaitResult Wait(TimeSpan timeout, bool aborting)
406if (timeout < TimeSpan.Zero)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\RequestContextBase.cs (13)
15private TimeSpan _defaultSendTimeout;
16private TimeSpan _defaultCloseTimeout;
25protected RequestContextBase(Message requestMessage, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout)
88public TimeSpan DefaultCloseTimeout
93public TimeSpan DefaultSendTimeout
125public override void Close(TimeSpan timeout)
127if (timeout < TimeSpan.Zero)
185protected abstract void OnClose(TimeSpan timeout);
186protected abstract void OnReply(Message message, TimeSpan timeout);
187protected abstract IAsyncResult OnBeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state);
229public override IAsyncResult BeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state)
252public override void Reply(Message message, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ServiceChannel.cs (55)
47private TimeSpan _operationTimeout;
175protected override TimeSpan DefaultCloseTimeout
180protected override TimeSpan DefaultOpenTimeout
211internal TimeSpan CloseTimeout
302internal TimeSpan OpenTimeout
317public TimeSpan OperationTimeout
322if (value < TimeSpan.Zero)
465manager.CallOnce(TimeSpan.MaxValue, null);
475return manager.BeginCallOnce(TimeSpan.MaxValue, null, callback, state);
497private void EnsureOpened(TimeSpan timeout)
509private IAsyncResult BeginEnsureOpened(TimeSpan timeout, AsyncCallback callback, object state)
683internal IAsyncResult BeginCall(string action, bool oneway, ProxyOperationRuntime operation, object[] ins, TimeSpan timeout, AsyncCallback callback, object asyncState)
725internal object Call(string action, bool oneway, ProxyOperationRuntime operation, object[] ins, object[] outs, TimeSpan timeout)
877private TimeoutException GetOpenTimeoutException(TimeSpan timeout)
1191public void Send(Message message, TimeSpan timeout)
1202public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
1218public Message Request(Message message, TimeSpan timeout)
1229public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
1261protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
1271protected override void OnClose(TimeSpan timeout)
1276protected internal override async Task OnCloseAsync(TimeSpan timeout)
1319protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
1329protected override void OnOpen(TimeSpan timeout)
1334protected internal override async Task OnOpenAsync(TimeSpan timeout)
1415IAsyncResult IDuplexContextChannel.BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state)
1425void IDuplexContextChannel.CloseOutputSession(TimeSpan timeout)
1659string action, object[] inputParameters, bool isOneWay, TimeSpan timeout,
1732TimeSpan timeout = Rpc.TimeoutHelper.RemainingTime();
1798TimeSpan timeout = Rpc.TimeoutHelper.RemainingTime();
1910void Call(ServiceChannel channel, TimeSpan timeout);
1911IAsyncResult BeginCall(ServiceChannel channel, TimeSpan timeout, AsyncCallback callback, object state);
1932private void ValidateTimeoutIsMaxValue(TimeSpan timeout)
1934if (timeout != TimeSpan.MaxValue)
1940void ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
1946IAsyncResult ICallOnce.BeginCall(ServiceChannel channel, TimeSpan timeout, AsyncCallback callback, object state)
1974void ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
1979IAsyncResult ICallOnce.BeginCall(ServiceChannel channel, TimeSpan timeout, AsyncCallback callback, object state)
2011internal void CallOnce(TimeSpan timeout, CallOnceManager cascade)
2060internal IAsyncResult BeginCallOnce(TimeSpan timeout, CallOnceManager cascade,
2226internal bool Wait(TimeSpan timeout)
2266private TimeSpan _timeout;
2269internal AsyncWaiter(CallOnceManager manager, TimeSpan timeout,
2276if (timeout != TimeSpan.MaxValue)
2278_timer = new Timer(new TimerCallback(s_timerCallback), this, timeout, TimeSpan.FromMilliseconds(-1));
2289if ((_timer == null) || _timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1)))
2302if ((_timer == null) || _timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1)))
2342private SessionIdleManager(IChannelBinder binder, TimeSpan idle)
2345_timer = new Timer(new TimerCallback(GetTimerCallback()), this, idle, TimeSpan.FromMilliseconds(-1));
2350internal static SessionIdleManager CreateIfNeeded(IChannelBinder binder, TimeSpan idle)
2352if (binder.HasSession && (idle != TimeSpan.MaxValue))
2378_timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
2447_timer.Change(Ticks.ToTimeSpan(abortTime - ticksNow), TimeSpan.FromMilliseconds(-1));
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ServiceChannelProxy.cs (11)
573void ICommunicationObject.Close(TimeSpan timeout)
583IAsyncResult ICommunicationObject.BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
598void ICommunicationObject.Open(TimeSpan timeout)
608IAsyncResult ICommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
688TimeSpan IContextChannel.OperationTimeout
735IAsyncResult IOutputChannel.BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
750void IOutputChannel.Send(Message message, TimeSpan timeout)
760Message IRequestChannel.Request(Message message, TimeSpan timeout)
770IAsyncResult IRequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
780public IAsyncResult BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state)
790public void CloseOutputSession(TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SocketConnection.cs (30)
17protected TimeSpan _sendTimeout;
18protected TimeSpan _receiveTimeout;
53_sendTimeout = _receiveTimeout = TimeSpan.MaxValue;
112public void Close(TimeSpan timeout, bool asyncAndLinger)
133private void Shutdown(TimeSpan timeout)
148protected abstract void ShutdownCore(TimeSpan timeout);
170protected Exception ConvertSendException(SocketException socketException, TimeSpan remainingTime)
176protected Exception ConvertReceiveException(SocketException socketException, TimeSpan remainingTime)
182internal static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException)
185TransferOperation.Undefined, false, null, TransferOperation.Undefined, null, TimeSpan.MaxValue);
204private static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException,
206SocketConnection socketConnection, TimeSpan remainingTime)
220remainingTime <= TimeSpan.Zero)
274public AsyncCompletionResult BeginWrite(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout,
287protected abstract AsyncCompletionResult BeginWriteCore(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout,
308public void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
313protected abstract void WriteCore(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout);
315public void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager)
327public int Read(byte[] buffer, int offset, int size, TimeSpan timeout)
340protected abstract int ReadCore(byte[] buffer, int offset, int size, TimeSpan timeout, bool closing);
342public virtual AsyncCompletionResult BeginRead(int offset, int size, TimeSpan timeout,
358protected abstract AsyncCompletionResult BeginReadCore(int offset, int size, TimeSpan timeout,
435public static Exception ConvertConnectException(SocketException socketException, Uri remoteUri, TimeSpan timeSpent, Exception innerException)
450if (timeSpent == TimeSpan.MaxValue)
471if (timeSpent == TimeSpan.MaxValue)
512private static TimeoutException CreateTimeoutException(Uri uri, TimeSpan timeout, IPAddress[] addresses, int invalidAddressCount,
535public IConnection Connect(Uri uri, TimeSpan timeout)
551if (timeoutHelper.RemainingTime() == TimeSpan.Zero)
587public async Task<IConnection> ConnectAsync(Uri uri, TimeSpan timeout)
603if (timeoutHelper.RemainingTime() == TimeSpan.Zero)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\TransportDefaults.cs (10)
193public static TimeSpan IdleTimeout { get { return TimeSpanHelper.FromMinutes(2, IdleTimeoutString); } }
195public static TimeSpan ChannelInitializationTimeout { get { return TimeSpanHelper.FromSeconds(30, ChannelInitializationTimeoutString); } }
200public static TimeSpan MaxOutputDelay { get { return TimeSpanHelper.FromMilliseconds(200, MaxOutputDelayString); } }
226public static TimeSpan ConnectionLeaseTimeout { get { return TimeSpanHelper.FromMinutes(5, TcpTransportDefaults.ConnectionLeaseTimeoutString); } }
271public static TimeSpan RequestInitializationTimeout { get { return TimeSpanHelper.FromMilliseconds(0, RequestInitializationTimeoutString); } }
308public static TimeSpan IdleTimeout { get { return TimeSpanHelper.FromMinutes(2, IdleTimeoutString); } }
311public static TimeSpan LeaseTimeout { get { return TimeSpanHelper.FromMinutes(10, LeaseTimeoutString); } }
320internal static TimeSpan AcknowledgementInterval { get { return TimeSpanHelper.FromMilliseconds(200, AcknowledgementIntervalString); } }
324internal static TimeSpan InactivityTimeout { get { return TimeSpanHelper.FromMinutes(10, InactivityTimeoutString); } }
354public static readonly TimeSpan DefaultKeepAliveInterval = TimeSpanHelper.FromSeconds(0, DefaultKeepAliveIntervalString);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\TransportDuplexSessionChannel.cs (29)
89public Message Receive(TimeSpan timeout)
120public async Task<Message> ReceiveAsync(TimeSpan timeout)
156public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
166public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
191public bool TryReceive(TimeSpan timeout, out Message message)
209public async Task<bool> WaitForMessageAsync(TimeSpan timeout)
232public bool WaitForMessage(TimeSpan timeout)
255public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
270protected abstract Task CloseOutputSessionCoreAsync(TimeSpan timeout);
272protected abstract void CloseOutputSessionCore(TimeSpan timeout);
274protected async Task CloseOutputSessionAsync(TimeSpan timeout)
329protected void CloseOutputSession(TimeSpan timeout)
385protected abstract void ReturnConnectionIfNecessary(bool abort, TimeSpan timeout);
389this.ReturnConnectionIfNecessary(true, TimeSpan.Zero);
395this.ReturnConnectionIfNecessary(true, TimeSpan.Zero);
398protected internal override async Task OnCloseAsync(TimeSpan timeout)
413protected override void OnClose(TimeSpan timeout)
428protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
488protected abstract AsyncCompletionResult StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout, Action<object> callback, object state);
490protected abstract AsyncCompletionResult BeginCloseOutput(TimeSpan timeout, Action<object> callback, object state);
498protected abstract void OnSendCore(Message message, TimeSpan timeout);
500protected abstract AsyncCompletionResult StartWritingStreamedMessage(Message message, TimeSpan timeout, Action<object> callback, object state);
502protected override async Task OnSendAsync(Message message, TimeSpan timeout)
607protected override void OnSend(Message message, TimeSpan timeout)
658protected abstract void CompleteClose(TimeSpan timeout);
669private async Task EnsureInputClosedAsync(TimeSpan timeout)
682private void EnsureInputClosed(TimeSpan timeout)
780public IAsyncResult BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state)
795public void CloseOutputSession(TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\UdpRetransmissionSettings.cs (24)
16private TimeSpan _delayLowerBound;
17private TimeSpan _delayUpperBound;
18private TimeSpan _maxDelayPerRetransmission;
35public UdpRetransmissionSettings(int maxUnicastRetransmitCount, int maxMulticastRetransmitCount, TimeSpan delayLowerBound, TimeSpan delayUpperBound, TimeSpan maxDelayPerRetransmission)
50if (delayLowerBound < TimeSpan.Zero)
52throw FxTrace.Exception.ArgumentOutOfRange("delayLowerBound", delayLowerBound, string.Format(SRServiceModel.ArgumentOutOfMinRange, TimeSpan.Zero));
55if (delayUpperBound < TimeSpan.Zero)
57throw FxTrace.Exception.ArgumentOutOfRange("delayUpperBound", delayUpperBound, string.Format(SRServiceModel.ArgumentOutOfMinRange, TimeSpan.Zero));
60if (maxDelayPerRetransmission < TimeSpan.Zero)
63string.Format(SRServiceModel.ArgumentOutOfMinRange, TimeSpan.Zero));
120public TimeSpan DelayLowerBound
128if (value < TimeSpan.Zero)
130throw FxTrace.Exception.ArgumentOutOfRange("value", value, string.Format(SRServiceModel.ArgumentOutOfMinRange, TimeSpan.Zero));
138public TimeSpan DelayUpperBound
146if (value < TimeSpan.Zero)
148throw FxTrace.Exception.ArgumentOutOfRange("value", value, string.Format(SRServiceModel.ArgumentOutOfMinRange, TimeSpan.Zero));
156public TimeSpan MaxDelayPerRetransmission
164if (value < TimeSpan.Zero)
166throw FxTrace.Exception.ArgumentOutOfRange("value", value, string.Format(SRServiceModel.ArgumentOutOfMinRange, TimeSpan.Zero));
265private bool TimeSpansEqual(TimeSpan ts1, TimeSpan ts2)
269return diff < TimeSpan.FromMilliseconds(1).Ticks || (max > 0 && diff / (double)max < 1e-3);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketHelper.cs (6)
120internal static void ThrowCorrectException(Exception ex, TimeSpan timeout, string operation)
129TimeSpan.MinValue, // this is a dummy since operation type is null, so the timespan value won't be used
135internal static Exception ConvertAndTraceException(Exception ex, TimeSpan timeout, string operation)
189internal static void ThrowExceptionOnTaskFailure(Task task, TimeSpan timeout, string operation)
202internal static Exception CreateExceptionOnTaskFailure(Task task, TimeSpan timeout, string operation)
215internal static TimeoutException GetTimeoutException(Exception innerException, TimeSpan timeout, string operation)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (22)
93protected override void CompleteClose(TimeSpan timeout)
112protected override void CloseOutputSessionCore(TimeSpan timeout)
126protected override async Task CloseOutputSessionCoreAsync(TimeSpan timeout)
158protected override void OnClose(TimeSpan timeout)
170protected internal override async Task OnCloseAsync(TimeSpan timeout)
182protected override void ReturnConnectionIfNecessary(bool abort, TimeSpan timeout)
186protected override AsyncCompletionResult StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout, Action<object> callback, object state)
226protected override AsyncCompletionResult StartWritingStreamedMessage(Message message, TimeSpan timeout, Action<object> callback, object state)
248protected override AsyncCompletionResult BeginCloseOutput(TimeSpan timeout, Action<object> callback, object state)
266protected override void OnSendCore(Message message, TimeSpan timeout)
396private async void HandleCloseOutputAsyncCompletion(Task task, TimeSpan timeout, Action<object> callback, object state)
412private async void HandleSendAsyncCompletion(Task task, TimeSpan timeout, Action<object> callback, object state)
474private TimeSpan _asyncReceiveTimeout;
516public async Task<Message> ReceiveAsync(TimeSpan timeout)
539public Message Receive(TimeSpan timeout)
614WebSocketHelper.ThrowCorrectException(ex, TimeSpan.MaxValue, WebSocketHelper.ReceiveOperation);
644_pendingException = WebSocketHelper.ConvertAndTraceException(ex, TimeSpan.MaxValue, WebSocketHelper.ReceiveOperation);
655public bool WaitForMessage(TimeSpan timeout)
674public async Task<bool> WaitForMessageAsync(TimeSpan timeout)
890private readonly TimeSpan _closeTimeout;
910TimeSpan closeTimeout)
926TimeSpan closeTimeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\ClientBase.cs (17)
193void ICommunicationObject.Open(TimeSpan timeout)
200void ICommunicationObject.Close(TimeSpan timeout)
284IAsyncResult ICommunicationObject.BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
299IAsyncResult ICommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
311internal IAsyncResult BeginFactoryOpen(TimeSpan timeout, AsyncCallback callback, object state)
321internal IAsyncResult BeginChannelOpen(TimeSpan timeout, AsyncCallback callback, object state)
331internal IAsyncResult BeginFactoryClose(TimeSpan timeout, AsyncCallback callback, object state)
348internal IAsyncResult BeginChannelClose(TimeSpan timeout, AsyncCallback callback, object state)
635TimeSpan IContextChannel.OperationTimeout
706void ICommunicationObject.Close(TimeSpan timeout)
716IAsyncResult ICommunicationObject.BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
731void ICommunicationObject.Open(TimeSpan timeout)
741IAsyncResult ICommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
776void IOutputChannel.Send(Message message, TimeSpan timeout)
786IAsyncResult IOutputChannel.BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
811Message IRequestChannel.Request(Message message, TimeSpan timeout)
821IAsyncResult IRequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\BufferedReceiveBinder.cs (10)
62public void CloseAfterFault(TimeSpan timeout)
73public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
95public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
130public void Send(Message message, TimeSpan timeout)
135public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
145public Message Request(Message message, TimeSpan timeout)
150public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
160public bool WaitForMessage(TimeSpan timeout)
165public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
193if (binder._channelBinder.TryReceive(TimeSpan.MaxValue, out requestContext))
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\DuplexChannelBinder.cs (43)
20private TimeSpan _defaultCloseTimeout;
21private TimeSpan _defaultSendTimeout;
63public TimeSpan DefaultCloseTimeout
89public TimeSpan DefaultSendTimeout
198public void CloseAfterFault(TimeSpan timeout)
245private TimeoutException GetReceiveTimeoutException(TimeSpan timeout)
304public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
348public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
358public void Send(Message message, TimeSpan timeout)
363public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
414public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
444public Message Request(Message message, TimeSpan timeout)
482TimeSpan remaining = timeoutHelper.RemainingTime();
613public bool WaitForMessage(TimeSpan timeout)
618public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
644protected override void OnClose(TimeSpan timeout)
648protected override void OnReply(Message message, TimeSpan timeout)
656protected override IAsyncResult OnBeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state)
671public ReplyAsyncResult(DuplexRequestContext context, Message message, TimeSpan timeout, AsyncCallback callback, object state)
762internal Message WaitForReply(TimeSpan timeout)
811private TimeSpan _timeout;
816internal AsyncDuplexRequest(Message message, DuplexChannelBinder parent, TimeSpan timeout, AsyncCallback callback, object state)
822if (timeout != TimeSpan.MaxValue)
824_timer = new Timer(new TimerCallback(AsyncDuplexRequest.s_timerCallback), this, timeout, TimeSpan.FromMilliseconds(-1));
885_timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
1113private TimeSpan DefaultCloseTimeout
1130private TimeSpan DefaultReceiveTimeout
1159result = _innerChannel.BeginReceive(TimeSpan.MaxValue, s_receiveAsyncCallback, this);
1328public Message Receive(TimeSpan timeout)
1338public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
1348public bool TryReceive(TimeSpan timeout, out Message message)
1353public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
1363public bool WaitForMessage(TimeSpan timeout)
1368public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
1394public void Close(TimeSpan timeout)
1417public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
1460public void Open(TimeSpan timeout)
1471public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
1487public void Send(Message message, TimeSpan timeout)
1497public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
1549public void WaitForBackgroundClose(TimeSpan timeout)
1556public IAsyncResult BeginWaitForBackgroundClose(TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\IChannelBinder.cs (9)
18void CloseAfterFault(TimeSpan timeout);
20bool TryReceive(TimeSpan timeout, out RequestContext requestContext);
21IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state);
24void Send(Message message, TimeSpan timeout);
25IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state);
28Message Request(Message message, TimeSpan timeout);
29IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state);
32bool WaitForMessage(TimeSpan timeout);
33IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state);
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\InputChannelBinder.cs (14)
62public void CloseAfterFault(TimeSpan timeout)
67public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
92public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
102public void Send(Message message, TimeSpan timeout)
107public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
122public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
132public Message Request(Message message, TimeSpan timeout)
137public bool WaitForMessage(TimeSpan timeout)
142public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
169: base(request, TimeSpan.Zero, TimeSpan.Zero)
178protected override void OnClose(TimeSpan timeout)
182protected override void OnReply(Message message, TimeSpan timeout)
186protected override IAsyncResult OnBeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\ListenerBinder.cs (12)
67public IChannelBinder Accept(TimeSpan timeout)
76public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
114public IChannelBinder Accept(TimeSpan timeout)
123public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
159public IChannelBinder Accept(TimeSpan timeout)
168public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
204public IChannelBinder Accept(TimeSpan timeout)
213public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
249public IChannelBinder Accept(TimeSpan timeout)
258public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
294public IChannelBinder Accept(TimeSpan timeout)
303public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\OutputChannelBinder.cs (9)
60public void CloseAfterFault(TimeSpan timeout)
65public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
80public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
90public void Send(Message message, TimeSpan timeout)
95public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
105public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
110public Message Request(Message message, TimeSpan timeout)
115public bool WaitForMessage(TimeSpan timeout)
120public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\ReplyChannelBinder.cs (9)
62public void CloseAfterFault(TimeSpan timeout)
67public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
82public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
92public void Send(Message message, TimeSpan timeout)
97public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
107public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
112public Message Request(Message message, TimeSpan timeout)
117public bool WaitForMessage(TimeSpan timeout)
122public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\RequestChannelBinder.cs (9)
54public void CloseAfterFault(TimeSpan timeout)
59public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
74public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
84public void Send(Message message, TimeSpan timeout)
89public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
99public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
104public Message Request(Message message, TimeSpan timeout)
118public bool WaitForMessage(TimeSpan timeout)
123public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\SecurityProtocolFactory.cs (32)
69internal static readonly TimeSpan defaultMaxClockSkew = TimeSpan.Parse(defaultMaxClockSkewString, CultureInfo.InvariantCulture);
70internal static readonly TimeSpan defaultReplayWindow = TimeSpan.Parse(defaultReplayWindowString, CultureInfo.InvariantCulture);
73internal static readonly TimeSpan defaultTimestampValidityDuration = TimeSpan.Parse(defaultTimestampValidityDurationString, CultureInfo.InvariantCulture);
93private TimeSpan _maxClockSkew = defaultMaxClockSkew;
96private TimeSpan _replayWindow = defaultReplayWindow;
102private TimeSpan _timestampValidityDuration = defaultTimestampValidityDuration;
408public TimeSpan MaxClockSkew
417if (value < TimeSpan.Zero)
455public TimeSpan ReplayWindow
464if (value <= TimeSpan.Zero)
566public TimeSpan TimestampValidityDuration
575if (value <= TimeSpan.Zero)
599public TimeSpan DefaultOpenTimeout
604public TimeSpan DefaultCloseTimeout
609public IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
614public IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
668public virtual void OnClose(TimeSpan timeout)
693public SecurityProtocol CreateSecurityProtocol(EndpointAddress target, Uri via, object listenerSecurityState, bool isReturnLegSecurityRequired, TimeSpan timeout)
733protected abstract SecurityProtocol OnCreateSecurityProtocol(EndpointAddress target, Uri via, object listenerSecurityState, TimeSpan timeout);
790private void MergeSupportingTokenAuthenticators(TimeSpan timeout)
953public virtual void OnOpen(TimeSpan timeout)
1021if (this.MaxClockSkew == TimeSpan.MaxValue || this.ReplayWindow == TimeSpan.MaxValue)
1037public void Open(bool actAsInitiator, TimeSpan timeout)
1043public IAsyncResult BeginOpen(bool actAsInitiator, TimeSpan timeout, AsyncCallback callback, object state)
1054public void Close(bool aborted, TimeSpan timeout)
1066public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
1076internal void Open(string propertyName, bool requiredForForwardDirection, SecurityTokenAuthenticator authenticator, TimeSpan timeout)
1088internal void Open(string propertyName, bool requiredForForwardDirection, SecurityTokenProvider provider, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\SecurityUtils.cs (14)
258return new DateTime(DateTime.MaxValue.Ticks - TimeSpan.TicksPerDay, DateTimeKind.Utc);
267return new DateTime(DateTime.MinValue.Ticks + TimeSpan.TicksPerDay, DateTimeKind.Utc);
665internal static void OpenTokenProviderIfRequired(SecurityTokenProvider tokenProvider, TimeSpan timeout)
670internal static void CloseTokenProviderIfRequired(SecurityTokenProvider tokenProvider, TimeSpan timeout)
677CloseCommunicationObject(tokenProvider, true, TimeSpan.Zero);
680internal static void OpenTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, TimeSpan timeout)
685internal static void CloseTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, TimeSpan timeout)
690internal static void CloseTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, bool aborted, TimeSpan timeout)
697CloseCommunicationObject(tokenAuthenticator, true, TimeSpan.Zero);
700private static void OpenCommunicationObject(ICommunicationObject obj, TimeSpan timeout)
706private static void CloseCommunicationObject(Object obj, bool aborted, TimeSpan timeout)
1060private Action<TimeSpan> _operationWithTimeout;
1062public OperationWithTimeoutAsyncResult(Action<TimeSpan> operationWithTimeout, TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\TimeBoundedCache.cs (6)
22private TimeSpan _purgeInterval;
27protected TimeBoundedCache(int lowWaterMark, int maxCacheItems, IEqualityComparer keyComparer, PurgingMode purgingMode, TimeSpan purgeInterval, bool doRemoveNotification)
92_purgingTimer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
106_purgingTimer = new Timer(new TimerCallback(PurgeCallback), this, _purgeInterval, TimeSpan.FromMilliseconds(-1));
436self._purgingTimer.Change(self._purgeInterval, TimeSpan.FromMilliseconds(-1));
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\WrapperSecurityCommunicationObject.cs (28)
32protected override TimeSpan DefaultCloseTimeout
37protected override TimeSpan DefaultOpenTimeout
47protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
52protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
57protected override void OnClose(TimeSpan timeout)
90protected override void OnOpen(TimeSpan timeout)
112protected internal override async Task OnCloseAsync(TimeSpan timeout)
125protected internal override async Task OnOpenAsync(TimeSpan timeout)
201public virtual TimeSpan DefaultOpenTimeout
206public virtual TimeSpan DefaultCloseTimeout
222public void Close(TimeSpan timeout)
232public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
247public void Open(TimeSpan timeout)
257public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
277public IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
282public IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
287public virtual void OnClose(TimeSpan timeout)
314public virtual void OnOpen(TimeSpan timeout)
376public virtual TimeSpan DefaultOpenTimeout
381public virtual TimeSpan DefaultCloseTimeout
397public void Close(TimeSpan timeout)
407public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
422public void Open(TimeSpan timeout)
432public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
452public IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
457public IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
462public virtual void OnClose(TimeSpan timeout)
489public virtual void OnOpen(TimeSpan timeout)
dotnet-user-jwts (2)
EntityFrameworkCoreSample (1)
Extensibility.WebSockets.IntegrationTests (13)
GenerateDocumentationAndConfigFiles (10)
GetDocument.Insider (9)
HealthChecksSandbox.AppHost (1)
HelixTestRunner (11)
HttpAbstractions.SampleApp (1)
HttpsPolicySample (1)
HttpStress (1)
IdeCoreBenchmarks (11)
SyntacticChangeRangeBenchmark.cs (6)
91SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(_root, newRoot, TimeSpan.MaxValue, CancellationToken.None);
98SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(_root, newRoot, TimeSpan.MaxValue, CancellationToken.None);
104SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(_root, _rootWithSimpleEdit, TimeSpan.MaxValue, CancellationToken.None);
110SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(_root, _rootWithComplexEdit, TimeSpan.MaxValue, CancellationToken.None);
117SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(_root, newRoot, TimeSpan.MaxValue, CancellationToken.None);
124SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(_root, newRoot, TimeSpan.MaxValue, CancellationToken.None);
IIS.Common.TestLib (4)
IIS.FunctionalTests (21)
IIS.LongTests (11)
IIS.Microbenchmarks (1)
IIS.NewHandler.FunctionalTests (11)
IIS.NewShim.FunctionalTests (11)
IIS.ShadowCopy.Tests (10)
IIS.Tests (1)
IISExpress.FunctionalTests (19)
Infrastructure.Common (6)
InMemory.FunctionalTests (218)
Http2\Http2TimeoutTests.cs (63)
29AdvanceTime(TimeSpan.FromTicks(1));
49AdvanceTime(TimeSpan.FromTicks(1));
68_mockTimeoutControl.Verify(c => c.SetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Once);
74_mockTimeoutControl.Setup(c => c.SetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive)).Callback<TimeSpan, TimeoutReason>((t, r) =>
84_mockTimeoutControl.Verify(c => c.SetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.RequestHeaders), Times.Once);
97AdvanceTime(TimeSpan.FromTicks(1));
117_mockTimeoutControl.Verify(c => c.SetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Once);
118_mockTimeoutControl.Verify(c => c.ResetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Never);
127_mockTimeoutControl.Verify(c => c.ResetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Once);
140_mockTimeoutControl.Verify(c => c.SetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Once);
141_mockTimeoutControl.Verify(c => c.ResetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Never);
157_mockTimeoutControl.Verify(c => c.ResetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Never);
188AdvanceTime(TimeSpan.FromTicks(1));
218AdvanceTime(TimeSpan.FromSeconds(_bytesReceived / limits.MinResponseDataRate.BytesPerSecond) +
219limits.MinResponseDataRate.GracePeriod + Heartbeat.Interval - TimeSpan.FromSeconds(.5));
224AdvanceTime(TimeSpan.FromSeconds(1));
274timeProvider.Advance(Constants.RequestBodyDrainTimeout + TimeSpan.FromTicks(1));
353limits.MinResponseDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
375AdvanceTime(TimeSpan.FromSeconds((_bytesReceived + _helloWorldBytes.Length) / limits.MinResponseDataRate.BytesPerSecond) +
376limits.MinResponseDataRate.GracePeriod + Heartbeat.Interval - TimeSpan.FromSeconds(.5));
380AdvanceTime(TimeSpan.FromSeconds(1));
406limits.MinResponseDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
427var timeToWriteMaxData = TimeSpan.FromSeconds((_bytesReceived + _maxData.Length) / limits.MinResponseDataRate.BytesPerSecond) +
428limits.MinResponseDataRate.GracePeriod + Heartbeat.Interval - TimeSpan.FromSeconds(.5);
435AdvanceTime(TimeSpan.FromSeconds(1));
461limits.MinResponseDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
484AdvanceTime(TimeSpan.FromSeconds(_bytesReceived / limits.MinResponseDataRate.BytesPerSecond) +
485limits.MinResponseDataRate.GracePeriod + Heartbeat.Interval - TimeSpan.FromSeconds(.5));
489AdvanceTime(TimeSpan.FromSeconds(1));
513limits.MinResponseDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
535var timeToWriteMaxData = TimeSpan.FromSeconds(_bytesReceived / limits.MinResponseDataRate.BytesPerSecond) +
536limits.MinResponseDataRate.GracePeriod + Heartbeat.Interval - TimeSpan.FromSeconds(.5);
543AdvanceTime(TimeSpan.FromSeconds(1));
567limits.MinResponseDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
601var timeToWriteMaxData = TimeSpan.FromSeconds(_bytesReceived / limits.MinResponseDataRate.BytesPerSecond) +
602limits.MinResponseDataRate.GracePeriod + Heartbeat.Interval - TimeSpan.FromSeconds(.5);
609AdvanceTime(TimeSpan.FromSeconds(1));
633limits.MinRequestBodyDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
656AdvanceTime(TimeSpan.FromTicks(1));
680limits.MinRequestBodyDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
700var timeToReadMaxData = TimeSpan.FromSeconds(_maxData.Length / limits.MinRequestBodyDataRate.BytesPerSecond) - TimeSpan.FromSeconds(.5);
707AdvanceTime(TimeSpan.FromSeconds(1));
731limits.MinRequestBodyDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
761var timeToReadMaxData = TimeSpan.FromSeconds(_maxData.Length / limits.MinRequestBodyDataRate.BytesPerSecond);
767timeToReadMaxData -= TimeSpan.FromSeconds(.5);
774AdvanceTime(TimeSpan.FromSeconds(1));
798limits.MinRequestBodyDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
835var timeToReadMaxData = TimeSpan.FromSeconds(_maxData.Length / limits.MinRequestBodyDataRate.BytesPerSecond) - TimeSpan.FromSeconds(.5);
842AdvanceTime(TimeSpan.FromSeconds(1));
866limits.MinRequestBodyDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
894AdvanceTime(TimeSpan.FromTicks(1));
923limits.MinRequestBodyDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
959AdvanceTime(TimeSpan.FromDays(1));
983AdvanceTime(TimeSpan.FromTicks(1));
InProcessWebSite (4)
InteractiveHost.UnitTests (1)
Interop.FunctionalTests (22)
InteropTests (16)
KeyManagementSimulator (6)
Metrics (10)
Metrics.Legacy (10)
Microsoft.Analyzers.Extra.Tests (1)
Microsoft.Arcade.Common (2)
Microsoft.AspNetCore.Authentication (6)
Microsoft.AspNetCore.Authentication.BearerToken (4)
Microsoft.AspNetCore.Authentication.Certificate (3)
Microsoft.AspNetCore.Authentication.Cookies (9)
Microsoft.AspNetCore.Authentication.Core (1)
Microsoft.AspNetCore.Authentication.Core.Test (4)
AuthenticationPropertiesTests.cs (4)
311ExpiresUtc = new DateTimeOffset(2021, 03, 28, 13, 47, 00, TimeSpan.Zero),
312IssuedUtc = new DateTimeOffset(2021, 03, 28, 12, 47, 00, TimeSpan.Zero),
367ExpiresUtc = new DateTimeOffset(2021, 03, 28, 13, 47, 00, TimeSpan.Zero),
368IssuedUtc = new DateTimeOffset(2021, 03, 28, 12, 47, 00, TimeSpan.Zero),
Microsoft.AspNetCore.Authentication.JwtBearer (6)
Microsoft.AspNetCore.Authentication.Negotiate (5)
Microsoft.AspNetCore.Authentication.OAuth (3)
Microsoft.AspNetCore.Authentication.OpenIdConnect (14)
Microsoft.AspNetCore.Authentication.Test (81)
OpenIdConnect\OpenIdConnectTests.cs (14)
403Assert.Equal(DateTime.MaxValue, GetNonceExpirationTime(noncePrefix + DateTime.MaxValue.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
405Assert.Equal(DateTime.MinValue + TimeSpan.FromHours(1), GetNonceExpirationTime(noncePrefix + DateTime.MinValue.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
407Assert.Equal(utcNow + TimeSpan.FromHours(1), GetNonceExpirationTime(noncePrefix + utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
409Assert.Equal(DateTime.MinValue, GetNonceExpirationTime(noncePrefix, TimeSpan.FromHours(1)));
411Assert.Equal(DateTime.MinValue, GetNonceExpirationTime("", TimeSpan.FromHours(1)));
413Assert.Equal(DateTime.MinValue, GetNonceExpirationTime(noncePrefix + noncePrefix, TimeSpan.FromHours(1)));
415Assert.Equal(utcNow + TimeSpan.FromHours(1), GetNonceExpirationTime(noncePrefix + utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter + utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
417Assert.Equal(DateTime.MinValue, GetNonceExpirationTime(utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter + utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
445Assert.Equal(options.BackchannelTimeout, TimeSpan.FromMinutes(5));
488Assert.Equal(TimeSpan.FromMinutes(1), options.BackchannelTimeout);
566private static DateTime GetNonceExpirationTime(string keyname, TimeSpan nonceLifetime)
Microsoft.AspNetCore.Authentication.Twitter (2)
Microsoft.AspNetCore.Authorization.Test (2)
AuthorizationMiddlewareTests.cs (2)
823var firstExpiration = new DateTimeOffset(2021, 5, 12, 2, 3, 4, TimeSpan.Zero);
824var secondExpiration = new DateTimeOffset(2021, 5, 11, 2, 3, 4, TimeSpan.Zero);
Microsoft.AspNetCore.Components (8)
Microsoft.AspNetCore.Components.Authorization.Tests (2)
Microsoft.AspNetCore.Components.Endpoints (15)
Microsoft.AspNetCore.Components.Endpoints.Tests (11)
Binding\FormDataMapperTests.cs (6)
2126{ "4/20/2023 12:56:34 PM +02:00", typeof(DateTimeOffset?), new DateTimeOffset?(new DateTimeOffset(2023, 04, 20, 12, 56, 34, TimeSpan.FromHours(2)))},
2127{ "02:01:03", typeof(TimeSpan?), new TimeSpan?(new TimeSpan(02, 01, 03))},
2169{ typeof(TimeSpan?) },
2211{ "4/20/2023 12:56:34 PM +02:00", typeof(DateTimeOffset), new DateTimeOffset(2023, 04, 20, 12, 56, 34, TimeSpan.FromHours(2)) },
2212{ "02:01:03", typeof(TimeSpan), new TimeSpan(02, 01, 03) },
Microsoft.AspNetCore.Components.Server (28)
Microsoft.AspNetCore.Components.Server.Tests (43)
Circuits\RemoteJSDataStreamTest.cs (6)
24var remoteJSDataStream = await RemoteJSDataStream.CreateRemoteJSDataStreamAsync(_jsRuntime, jsStreamReference, totalLength: 100, signalRMaximumIncomingBytes: 10_000, jsInteropDefaultCallTimeout: TimeSpan.FromMinutes(1), cancellationToken: CancellationToken.None).DefaultTimeout();
162var remoteJSDataStream = await RemoteJSDataStream.CreateRemoteJSDataStreamAsync(jsRuntime, jsStreamReference, totalLength: 100, signalRMaximumIncomingBytes: 10_000, jsInteropDefaultCallTimeout: TimeSpan.FromMinutes(1), cancellationToken: CancellationToken.None);
182var remoteJSDataStream = await RemoteJSDataStream.CreateRemoteJSDataStreamAsync(jsRuntime, jsStreamReference, totalLength: 100, signalRMaximumIncomingBytes: 10_000, jsInteropDefaultCallTimeout: TimeSpan.FromMinutes(1), cancellationToken: CancellationToken.None);
218jsInteropDefaultCallTimeout: TimeSpan.FromSeconds(2),
259jsInteropDefaultCallTimeout: TimeSpan.FromSeconds(3),
348var remoteJSDataStream = await RemoteJSDataStream.CreateRemoteJSDataStreamAsync(jsRuntime ?? _jsRuntime, jsStreamReference, totalLength: 100, signalRMaximumIncomingBytes: 10_000, jsInteropDefaultCallTimeout: TimeSpan.FromMinutes(1), cancellationToken: CancellationToken.None);
Microsoft.AspNetCore.Components.Tests (15)
SupplyParameterFromPersistentComponentStateValueProviderTests.cs (2)
232{ new DateTimeOffset(2023, 1, 1, 0, 0, 0, TimeSpan.FromSeconds(0)), new DateTimeOffset(2023, 12, 31, 0, 0, 0, TimeSpan.FromSeconds(0)) },
Microsoft.AspNetCore.Components.Web (2)
Microsoft.AspNetCore.Components.WebAssembly.Server (6)
Microsoft.AspNetCore.Components.WebAssembly.Tests (3)
Microsoft.AspNetCore.Components.WebViewE2E.Test (1)
Microsoft.AspNetCore.ConcurrencyLimiter (1)
Microsoft.AspNetCore.ConcurrencyLimiter.Tests (2)
Microsoft.AspNetCore.CookiePolicy (1)
Microsoft.AspNetCore.CookiePolicy.Test (2)
Microsoft.AspNetCore.Cors (10)
Microsoft.AspNetCore.Cors.Test (13)
Microsoft.AspNetCore.DataProtection (28)
Microsoft.AspNetCore.DataProtection.Extensions (3)
Microsoft.AspNetCore.DataProtection.Extensions.Tests (2)
Microsoft.AspNetCore.DataProtection.Tests (55)
KeyManagement\KeyRingProviderTests.cs (26)
118Tuple.Create((DateTimeOffset)now, (DateTimeOffset)now + TimeSpan.FromDays(90), CreateKey())
166Tuple.Create(now, now + TimeSpan.FromDays(90), newKey)
207Tuple.Create((DateTimeOffset)now, (DateTimeOffset)now + TimeSpan.FromDays(90), newlyCreatedKey)
251Tuple.Create((DateTimeOffset)now, (DateTimeOffset)now + TimeSpan.FromDays(90), CreateKey())
291Tuple.Create(key1.ExpirationDate, (DateTimeOffset)now + TimeSpan.FromDays(90), CreateKey())
432DateTimeOffset activation1 = now - TimeSpan.FromHours(1);
433DateTimeOffset activation2 = now + TimeSpan.FromHours(1);
435DateTimeOffset expiration1 = now + TimeSpan.FromHours(hoursToExpiration1);
436DateTimeOffset expiration2 = now + TimeSpan.FromHours(hoursToExpiration2);
449var generatedKey = CreateKey(expiration1, now + TimeSpan.FromDays(90));
504Tuple.Create(expiration1, now + TimeSpan.FromDays(90), CreateKey())
525DateTimeOffset activation = now - TimeSpan.FromDays(30);
526DateTimeOffset expiration = now + TimeSpan.FromDays(30);
529var generatedKey = CreateKey(expiration, now + TimeSpan.FromDays(90));
539Tuple.Create(expiration, now + TimeSpan.FromDays(90), generatedKey)
590var retVal2 = keyRingProvider.GetCurrentKeyRingCore(now + TimeSpan.FromHours(1));
613.Setup(o => o.GetCacheableKeyRing(now + TimeSpan.FromMinutes(1)))
619.Setup(o => o.GetCacheableKeyRing(now + TimeSpan.FromMinutes(2)))
629var retVal2 = keyRingProvider.GetCurrentKeyRingCore(now + TimeSpan.FromMinutes(1));
630var retVal3 = keyRingProvider.GetCurrentKeyRingCore(now + TimeSpan.FromMinutes(2), forceRefresh: true);
654.Setup(o => o.GetCacheableKeyRing(now + TimeSpan.FromHours(1)))
664var retVal2 = keyRingProvider.GetCurrentKeyRingCore(now + TimeSpan.FromHours(1), forceRefresh: true);
686TimeSpan testTimeout = TimeSpan.FromSeconds(10);
912Assert.InRange(actual, now + TimeSpan.FromHours(24 * 0.8), now + TimeSpan.FromHours(24));
KeyManagement\XmlKeyManagerTests.cs (8)
78var creationDate = new DateTimeOffset(2014, 01, 01, 0, 0, 0, TimeSpan.Zero);
79var activationDate = new DateTimeOffset(2014, 02, 01, 0, 0, 0, TimeSpan.Zero);
80var expirationDate = new DateTimeOffset(2014, 03, 01, 0, 0, 0, TimeSpan.Zero);
165var creationDate = new DateTimeOffset(2014, 01, 01, 0, 0, 0, TimeSpan.Zero);
166var activationDate = new DateTimeOffset(2014, 02, 01, 0, 0, 0, TimeSpan.Zero);
167var expirationDate = new DateTimeOffset(2014, 03, 01, 0, 0, 0, TimeSpan.Zero);
295DateTimeOffset activationDate = minCreationDate + TimeSpan.FromDays(7);
685var revocationDate = new DateTimeOffset(2014, 01, 01, 0, 0, 0, TimeSpan.Zero);
Microsoft.AspNetCore.DeveloperCertificates.XPlat (2)
Microsoft.AspNetCore.Diagnostics.Middleware (3)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (24)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (6)
ConverterTests\JsonConverterWriteTests.cs (4)
285TimestampValue = Timestamp.FromDateTimeOffset(new DateTimeOffset(2020, 12, 1, 12, 30, 0, TimeSpan.FromHours(12)))
294var ts = Timestamp.FromDateTimeOffset(new DateTimeOffset(2020, 12, 1, 12, 30, 0, TimeSpan.FromHours(12)));
304DurationValue = Duration.FromTimeSpan(TimeSpan.FromHours(12))
313var duration = Duration.FromTimeSpan(TimeSpan.FromHours(12));
Microsoft.AspNetCore.HeaderParsing.Tests (1)
Microsoft.AspNetCore.Hosting (10)
Microsoft.AspNetCore.Hosting.Abstractions (1)
Microsoft.AspNetCore.Hosting.FunctionalTests (4)
Microsoft.AspNetCore.Hosting.Tests (10)
Microsoft.AspNetCore.Hosting.WindowsServices.Tests (2)
Microsoft.AspNetCore.Http (8)
Microsoft.AspNetCore.Http.Abstractions (2)
Microsoft.AspNetCore.Http.Abstractions.Tests (3)
Microsoft.AspNetCore.Http.Connections (30)
Microsoft.AspNetCore.Http.Connections.Client (5)
Microsoft.AspNetCore.Http.Connections.Tests (38)
Microsoft.AspNetCore.Http.Extensions (6)
Microsoft.AspNetCore.Http.Extensions.Tests (10)
Microsoft.AspNetCore.Http.Features (8)
Microsoft.AspNetCore.Http.Microbenchmarks (4)
Microsoft.AspNetCore.Http.Results (2)
Microsoft.AspNetCore.Http.Results.Tests (14)
ResultsTests.cs (5)
285new object[] { 0, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
287new object[] { 1, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
333new object[] { 0, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
335new object[] { 1, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
337new object[] { 2, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
TypedResultsTests.cs (7)
263new object[] { 0, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
265new object[] { 1, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
309new object[] { "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
311new object[] { "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
417new object[] { 0, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
419new object[] { 1, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
421new object[] { 2, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
Microsoft.AspNetCore.Http.Tests (24)
Timeouts\RequestTimeoutsMiddlewareTests.cs (10)
49var endpoint = CreateEndpoint(new RequestTimeoutPolicy { Timeout = TimeSpan.FromSeconds(47) });
144var endpoint = CreateEndpoint(new RequestTimeoutPolicy { Timeout = TimeSpan.FromSeconds(47) }, new RequestTimeoutAttribute("policy1"));
164new RequestTimeoutPolicy { Timeout = TimeSpan.FromSeconds(47) },
284var ctsLinker = new MockCancellationTokenSourceProvider(expectedTimeSpan.HasValue ? TimeSpan.FromSeconds(expectedTimeSpan.Value) : null, cancelledCts);
289Timeout = TimeSpan.FromSeconds(defaultTimeout.Value),
300Timeout = TimeSpan.FromSeconds(1),
310Timeout = TimeSpan.FromSeconds(2),
348private readonly TimeSpan? _expectedTimeSpan;
356public MockCancellationTokenSourceProvider(TimeSpan? expectedTimeSpan, bool cancelledCts)
362public (CancellationTokenSource linkedCts, CancellationTokenSource timeoutCts) GetLinkedCancellationTokenSource(HttpContext httpContext, CancellationToken originalToken, TimeSpan timeSpan)
Microsoft.AspNetCore.HttpLogging (6)
Microsoft.AspNetCore.HttpLogging.Tests (1)
Microsoft.AspNetCore.HttpsPolicy (2)
Microsoft.AspNetCore.HttpsPolicy.Tests (3)
Microsoft.AspNetCore.Identity (14)
Microsoft.AspNetCore.Identity.FunctionalTests (11)
Microsoft.AspNetCore.Identity.InMemory.Test (10)
Microsoft.AspNetCore.Identity.Specification.Tests (4)
Microsoft.AspNetCore.Identity.Test (16)
Microsoft.AspNetCore.InternalTesting (14)
src\Shared\TaskExtensions.cs (13)
32public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
36return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
39public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
46return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
49public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
56return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
59public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
66return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
69public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
75public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
109public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
143private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Microsoft.AspNetCore.InternalTesting.Tests (6)
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (19)
EndpointMetadataApiDescriptionProviderTest.cs (19)
188[ProducesResponseType(typeof(TimeSpan), StatusCodes.Status201Created)]
205Assert.Equal(typeof(TimeSpan), annotatedResponseType.Type);
206Assert.Equal(typeof(TimeSpan), annotatedResponseType.ModelMetadata?.ModelType);
215[ProducesResponseType(typeof(TimeSpan), StatusCodes.Status201Created)]
233Assert.Equal(typeof(TimeSpan), createdResponseType.Type);
234Assert.Equal(typeof(TimeSpan), createdResponseType.ModelMetadata?.ModelType);
310[ProducesResponseType(typeof(TimeSpan), StatusCodes.Status201Created, Description = expectedCreatedDescription)]
319Assert.Equal(typeof(TimeSpan), createdResponseType.Type);
320Assert.Equal(typeof(TimeSpan), createdResponseType.ModelMetadata?.ModelType);
341[ProducesResponseType(typeof(TimeSpan), StatusCodes.Status201Created, Description = expectedCreatedDescription)]
360Assert.Equal(typeof(TimeSpan), createdResponseType.Type);
361Assert.Equal(typeof(TimeSpan), createdResponseType.ModelMetadata?.ModelType);
391[ProducesResponseType(typeof(TimeSpan), StatusCodes.Status201Created, Description = expectedCreatedDescription)] // This is the last item, which should match
401Assert.Equal(typeof(TimeSpan), createdResponseType.Type);
402Assert.Equal(typeof(TimeSpan), createdResponseType.ModelMetadata?.ModelType);
587AssertPathParameter(GetApiDescription((TimeSpan foo) => { }, "/{foo}"), typeof(TimeSpan));
608AssertPathParameter(GetApiDescription((TimeSpan? foo) => { }, "/{foo}"), typeof(TimeSpan?));
Microsoft.AspNetCore.Mvc.Core (5)
Microsoft.AspNetCore.Mvc.Core.Test (31)
FileResultHelperTest.cs (15)
251lastModified = new DateTimeOffset(lastModified.Year, lastModified.Month, lastModified.Day, lastModified.Hour, lastModified.Minute, lastModified.Second, TimeSpan.FromSeconds(0));
329lastModified = new DateTimeOffset(lastModified.Year, lastModified.Month, lastModified.Day, lastModified.Hour, lastModified.Minute, lastModified.Second, TimeSpan.FromSeconds(0));
365lastModified = new DateTimeOffset(lastModified.Year, lastModified.Month, lastModified.Day, lastModified.Hour, lastModified.Minute, lastModified.Second, TimeSpan.FromSeconds(0));
388{ new DateTimeOffset(2018, 4, 9, 11, 23, 22, TimeSpan.Zero), 200 },
389{ new DateTimeOffset(2018, 4, 9, 11, 24, 21, TimeSpan.Zero), 200 },
390{ new DateTimeOffset(2018, 4, 9, 11, 24, 22, TimeSpan.Zero), 304 },
391{ new DateTimeOffset(2018, 4, 9, 11, 24, 23, TimeSpan.Zero), 304 },
392{ new DateTimeOffset(2018, 4, 9, 11, 25, 22, TimeSpan.Zero), 304 },
412LastModified = new DateTimeOffset(ticks, TimeSpan.Zero)
428{ new DateTimeOffset(2018, 4, 9, 11, 23, 22, TimeSpan.Zero), 412 },
429{ new DateTimeOffset(2018, 4, 9, 11, 24, 21, TimeSpan.Zero), 412 },
430{ new DateTimeOffset(2018, 4, 9, 11, 24, 22, TimeSpan.Zero), 200 },
431{ new DateTimeOffset(2018, 4, 9, 11, 24, 23, TimeSpan.Zero), 200 },
432{ new DateTimeOffset(2018, 4, 9, 11, 25, 22, TimeSpan.Zero), 200 },
450LastModified = new DateTimeOffset(ticks, TimeSpan.Zero)
Infrastructure\ActionSelectionTableTest.cs (2)
83new DateTimeOffset(2018, 10, 31, 7, 37, 38, TimeSpan.FromHours(-7)));
123new DateTimeOffset(2018, 10, 31, 7, 37, 38, TimeSpan.FromHours(-7)));
ModelBinding\RouteValueProviderTests.cs (2)
53{ "test-key", new DateTimeOffset(2018, 10, 31, 7, 37, 38, TimeSpan.FromHours(-7)) },
70{ "test-key", new DateTimeOffset(2018, 10, 31, 7, 37, 38, TimeSpan.FromHours(-7)) },
Microsoft.AspNetCore.Mvc.Cors.Test (1)
Microsoft.AspNetCore.Mvc.FunctionalTests (5)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (2)
Microsoft.AspNetCore.Mvc.Razor (2)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (1)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (4)
Microsoft.AspNetCore.Mvc.Razor.Test (1)
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
Microsoft.AspNetCore.Mvc.TagHelpers (6)
Microsoft.AspNetCore.Mvc.TagHelpers.Test (43)
CacheTagHelperTest.cs (22)
257var slidingExpiresIn = TimeSpan.FromSeconds(30);
272var expiresAfter = TimeSpan.FromSeconds(42);
290var expiresSliding = TimeSpan.FromSeconds(37);
326var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
340ExpiresAfter = TimeSpan.FromMinutes(10)
361ExpiresAfter = TimeSpan.FromMinutes(10)
379var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
432var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
446ExpiresSliding = TimeSpan.FromSeconds(30)
468ExpiresSliding = TimeSpan.FromSeconds(30)
571await event3.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
594await event1.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
601await event2.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
654await event3.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
677await event1.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
684await event2.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
746ExpiresAfter = TimeSpan.FromHours(1.0)
973public TimeSpan? AbsoluteExpirationRelativeToNow { get; set; }
974public TimeSpan? SlidingExpiration { get; set; }
DistributedCacheTagHelperTest.cs (19)
274var slidingExpiresIn = TimeSpan.FromSeconds(30);
297var expiresAfter = TimeSpan.FromSeconds(42);
323var expiresSliding = TimeSpan.FromSeconds(37);
349var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
370ExpiresAfter = TimeSpan.FromMinutes(10)
393ExpiresAfter = TimeSpan.FromMinutes(10)
411var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
473var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
494ExpiresSliding = TimeSpan.FromSeconds(30)
518ExpiresSliding = TimeSpan.FromSeconds(30)
570await event3.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
597await event1.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
604await event2.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
662await event3.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
689await event1.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
696await event2.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
Microsoft.AspNetCore.Mvc.Testing (8)
Microsoft.AspNetCore.Mvc.ViewFeatures (5)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (11)
Microsoft.AspNetCore.OpenApi (1)
Microsoft.AspNetCore.OpenApi.Build.Tests (2)
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (8)
Microsoft.AspNetCore.OpenApi.Tests (4)
Microsoft.AspNetCore.OutputCaching (20)
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (1)
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (15)
RedisOutputCacheStore.cs (15)
43private readonly TimeSpan ReconnectMinInterval = TimeSpan.FromSeconds(60);
46private readonly TimeSpan ReconnectErrorThreshold = TimeSpan.FromSeconds(30);
100await Task.Delay(TimeSpan.FromSeconds(secondsWithJitter)).ConfigureAwait(false);
105await ExecuteGarbageCollectionAsync(GetExpirationTimestamp(TimeSpan.Zero), _disposalCancellation.Token).ConfigureAwait(false);
131var gcLifetime = TimeSpan.FromMinutes(5);
237ValueTask IOutputCacheStore.SetAsync(string key, byte[] value, string[]? tags, TimeSpan validFor, CancellationToken cancellationToken)
243async ValueTask IOutputCacheBufferStore.SetAsync(string key, ReadOnlySequence<byte> value, ReadOnlyMemory<string> tags, TimeSpan validFor, CancellationToken cancellationToken)
309private static long GetExpirationTimestamp(TimeSpan timeout) =>
372TimeSpan elapsedSinceLastReconnect = utcNow - previousConnectTime;
389TimeSpan elapsedSinceFirstError = utcNow - firstErrorTime;
390TimeSpan elapsedSinceMostRecentError = utcNow - ReadTimeTicks(ref _previousErrorTimeTicks);
482return ticks == 0 ? DateTimeOffset.MinValue : new DateTimeOffset(ticks, TimeSpan.Zero);
Microsoft.AspNetCore.OutputCaching.Tests (74)
MemoryOutputCacheStoreTests.cs (25)
18await store.SetAsync(key, value, null, TimeSpan.FromMinutes(1), default);
33await store.SetAsync(key, value, null, TimeSpan.FromMilliseconds(5), default);
34testClock.Advance(TimeSpan.FromMilliseconds(10));
48_ = await Assert.ThrowsAsync<ArgumentNullException>("key", () => store.SetAsync(key, value, null, TimeSpan.FromMilliseconds(5), default).AsTask());
58_ = await Assert.ThrowsAsync<ArgumentNullException>("value", () => store.SetAsync(key, value, null, TimeSpan.FromMilliseconds(5), default).AsTask());
70await store.SetAsync(key, value, tags, TimeSpan.FromDays(1), default);
78using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
99await store.SetAsync(key1, value, tags, TimeSpan.FromDays(1), default);
100await store.SetAsync(key2, value, tags, TimeSpan.FromDays(1), default);
118await store.SetAsync(key, value, tags, TimeSpan.FromDays(1), default);
136await store.SetAsync(key1, value, tags1, TimeSpan.FromDays(1), default);
137await store.SetAsync(key2, value, tags2, TimeSpan.FromDays(1), default);
159var cache = new MemoryCache(new MemoryCacheOptions { SizeLimit = 1000, Clock = testClock, ExpirationScanFrequency = TimeSpan.FromMilliseconds(1) });
163await store.SetAsync("a", value, new[] { "tag1" }, TimeSpan.FromMilliseconds(5), default);
164await store.SetAsync("b", value, new[] { "tag1", "tag2" }, TimeSpan.FromMilliseconds(5), default);
165await store.SetAsync("c", value, new[] { "tag2" }, TimeSpan.FromMilliseconds(20), default);
167testClock.Advance(TimeSpan.FromMilliseconds(10));
184using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
204var cache = new MemoryCache(new MemoryCacheOptions { SizeLimit = 1000, Clock = testClock, ExpirationScanFrequency = TimeSpan.FromMilliseconds(1) });
208await store.SetAsync("a", value, new[] { "tag1", "tag2" }, TimeSpan.FromMilliseconds(5), default);
209await store.SetAsync("a", value, new[] { "tag1" }, TimeSpan.FromMilliseconds(20), default);
211testClock.Advance(TimeSpan.FromMilliseconds(10));
224using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
245await Assert.ThrowsAsync<ArgumentException>(async () => await store.SetAsync(key, value, new string[] { tag }, TimeSpan.FromMinutes(1), default));
251public void Advance(TimeSpan duration)
OutputCacheEntryFormatterTests.cs (3)
35await OutputCacheEntryFormatter.StoreAsync(key, entry, null, TimeSpan.Zero, store, NullLogger.Instance, default);
54await OutputCacheEntryFormatter.StoreAsync(key, entry, new HashSet<string>() { "tag", "タグ" }, TimeSpan.Zero, store, NullLogger.Instance, default);
72await OutputCacheEntryFormatter.StoreAsync(key, entry, null, TimeSpan.Zero, store, NullLogger.Instance, default);
OutputCacheMiddlewareTests.cs (27)
83TimeSpan.Zero,
113TimeSpan.Zero,
141TimeSpan.Zero,
187SetDateHeader(context.CachedResponse, utcNow - TimeSpan.FromSeconds(10));
197SetDateHeader(context.CachedResponse, utcNow + TimeSpan.FromSeconds(10));
229SetDateHeaders(context.CachedResponse, utcNow + TimeSpan.FromSeconds(10), utcNow - TimeSpan.FromSeconds(10));
234SetDateHeaders(context.CachedResponse, utcNow + TimeSpan.FromSeconds(10), utcNow);
239SetDateHeaders(context.CachedResponse, utcNow - TimeSpan.FromSeconds(10), utcNow + TimeSpan.FromSeconds(10));
261entry.CopyHeadersFrom(new HeaderDictionary { [HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)) });
282context.CachedResponse.CopyHeadersFrom(new HeaderDictionary { [HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow - TimeSpan.FromSeconds(10)) });
398timeProvider.Advance(TimeSpan.FromSeconds(10));
414Assert.Equal(TimeSpan.FromSeconds(60), context.CachedResponseValidFor);
433context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11));
458MaxAge = TimeSpan.FromSeconds(12)
461context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11));
484MaxAge = TimeSpan.FromSeconds(12),
485SharedMaxAge = TimeSpan.FromSeconds(13)
487context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11));
557var responseTime = utcNow + TimeSpan.FromSeconds(10);
618context.CachedResponseValidFor = TimeSpan.FromSeconds(10);
647context.CachedResponseValidFor = TimeSpan.FromSeconds(10);
680context.CachedResponseValidFor = TimeSpan.FromSeconds(10);
705context.CachedResponseValidFor = TimeSpan.FromSeconds(10);
777context.CachedResponseValidFor = TimeSpan.FromSeconds(10);
981context.CachedResponseValidFor = TimeSpan.FromSeconds(10);
Microsoft.AspNetCore.RateLimiting (3)
Microsoft.AspNetCore.RateLimiting.Tests (2)
Microsoft.AspNetCore.ResponseCaching (32)
LoggerExtensions.cs (12)
32internal static partial void ExpirationMinFreshAdded(this ILogger logger, TimeSpan duration);
36internal static partial void ExpirationSharedMaxAgeExceeded(this ILogger logger, TimeSpan age, TimeSpan sharedMaxAge);
41internal static partial void ExpirationMustRevalidate(this ILogger logger, TimeSpan age, TimeSpan maxAge);
46internal static partial void ExpirationMaxStaleSatisfied(this ILogger logger, TimeSpan age, TimeSpan maxAge, TimeSpan maxStale);
49internal static partial void ExpirationMaxAgeExceeded(this ILogger logger, TimeSpan age, TimeSpan maxAge);
122internal static partial void ExpirationInfiniteMaxStaleSatisfied(this ILogger logger, TimeSpan age, TimeSpan maxAge);
Microsoft.AspNetCore.ResponseCaching.Tests (87)
ResponseCachingPolicyProviderTests.cs (49)
411MaxAge = TimeSpan.FromSeconds(10)
415context.ResponseTime = utcNow + TimeSpan.FromSeconds(9);
431MaxAge = TimeSpan.FromSeconds(10)
435context.ResponseTime = utcNow + TimeSpan.FromSeconds(10);
453MaxAge = TimeSpan.FromSeconds(10),
454SharedMaxAge = TimeSpan.FromSeconds(15)
457context.ResponseTime = utcNow + TimeSpan.FromSeconds(11);
473MaxAge = TimeSpan.FromSeconds(10),
474SharedMaxAge = TimeSpan.FromSeconds(5)
477context.ResponseTime = utcNow + TimeSpan.FromSeconds(5);
492context.CachedEntryAge = TimeSpan.MaxValue;
506context.CachedEntryAge = TimeSpan.MaxValue;
524context.CachedEntryAge = TimeSpan.Zero;
544context.CachedEntryAge = TimeSpan.FromSeconds(9);
550MaxAge = TimeSpan.FromSeconds(10)
564context.CachedEntryAge = TimeSpan.FromSeconds(10);
570MaxAge = TimeSpan.FromSeconds(10)
586context.CachedEntryAge = TimeSpan.FromSeconds(11);
592MaxAge = TimeSpan.FromSeconds(10),
593SharedMaxAge = TimeSpan.FromSeconds(15)
607context.CachedEntryAge = TimeSpan.FromSeconds(5);
613MaxAge = TimeSpan.FromSeconds(10),
614SharedMaxAge = TimeSpan.FromSeconds(5)
631MinFresh = TimeSpan.FromSeconds(2)
636MaxAge = TimeSpan.FromSeconds(10),
637SharedMaxAge = TimeSpan.FromSeconds(5)
639context.CachedEntryAge = TimeSpan.FromSeconds(3);
655MaxAge = TimeSpan.FromSeconds(5)
660MaxAge = TimeSpan.FromSeconds(10),
662context.CachedEntryAge = TimeSpan.FromSeconds(5);
677MaxAge = TimeSpan.FromSeconds(5),
679MaxStaleLimit = TimeSpan.FromSeconds(2)
684MaxAge = TimeSpan.FromSeconds(5),
686context.CachedEntryAge = TimeSpan.FromSeconds(6);
701MaxAge = TimeSpan.FromSeconds(5),
707MaxAge = TimeSpan.FromSeconds(5),
709context.CachedEntryAge = TimeSpan.FromSeconds(6);
724MaxAge = TimeSpan.FromSeconds(5),
726MaxStaleLimit = TimeSpan.FromSeconds(1)
731MaxAge = TimeSpan.FromSeconds(5),
733context.CachedEntryAge = TimeSpan.FromSeconds(6);
748MaxAge = TimeSpan.FromSeconds(5),
750MaxStaleLimit = TimeSpan.FromSeconds(2)
755MaxAge = TimeSpan.FromSeconds(5),
758context.CachedEntryAge = TimeSpan.FromSeconds(6);
773MaxAge = TimeSpan.FromSeconds(5),
775MaxStaleLimit = TimeSpan.FromSeconds(2)
780MaxAge = TimeSpan.FromSeconds(5),
783context.CachedEntryAge = TimeSpan.FromSeconds(6);
Microsoft.AspNetCore.ResponseCompression.Tests (8)
Microsoft.AspNetCore.Rewrite (13)
Microsoft.AspNetCore.Rewrite.Tests (3)
Microsoft.AspNetCore.Routing (2)
Microsoft.AspNetCore.Server.HttpSys (20)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (70)
ServerTests.cs (29)
157await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
158await server.StopAsync(new CancellationTokenSource(TimeSpan.FromSeconds(5)).Token);
173await stopped.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
179await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
194await shutdown.Task.TimeoutAfter(TimeSpan.FromSeconds(15));
200await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
201await server.StopAsync(new CancellationTokenSource(TimeSpan.FromSeconds(5)).Token);
270Assert.True(Task.WaitAll(requestTasks.ToArray(), TimeSpan.FromSeconds(60)), "Timed out");
277var interval = TimeSpan.FromSeconds(10);
311var interval = TimeSpan.FromSeconds(10);
423await run.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
429await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
431var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
442await Task.WhenAll(stopTask1, stopTask2, stopTask3).TimeoutAfter(TimeSpan.FromSeconds(10));
457await run.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
463await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
476await Task.WhenAll(stopTask1, stopTask2, stopTask3).TimeoutAfter(TimeSpan.FromSeconds(10));
494await run.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
500await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
513await Task.WhenAll(stopTask1, stopTask2, stopTask3).TimeoutAfter(TimeSpan.FromSeconds(10));
531await run.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
537await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
550await Task.WhenAll(stopTask1, stopTask2, stopTask3).TimeoutAfter(TimeSpan.FromSeconds(10));
570await run.Task.TimeoutAfter(TimeSpan.FromSeconds(15));
576await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
585await Task.WhenAll(stopTask1, stopTask2).TimeoutAfter(TimeSpan.FromSeconds(10));
594await server.StopAsync(default(CancellationToken)).TimeoutAfter(TimeSpan.FromSeconds(10));
Microsoft.AspNetCore.Server.HttpSys.NonHelixTests (2)
Microsoft.AspNetCore.Server.IIS (4)
Microsoft.AspNetCore.Server.IISIntegration.Tests (4)
Microsoft.AspNetCore.Server.IntegrationTesting (21)
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (12)
Microsoft.AspNetCore.Server.Kestrel.Core (88)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (131)
KestrelServerLimitsTests.cs (19)
153Assert.Equal(TimeSpan.FromSeconds(130), new KestrelServerLimits().KeepAliveTimeout);
158public void KeepAliveTimeoutValid(TimeSpan value)
166Assert.Equal(TimeSpan.MaxValue, new KestrelServerLimits { KeepAliveTimeout = Timeout.InfiniteTimeSpan }.KeepAliveTimeout);
171public void KeepAliveTimeoutInvalid(TimeSpan value)
182Assert.Equal(TimeSpan.FromSeconds(30), new KestrelServerLimits().RequestHeadersTimeout);
187public void RequestHeadersTimeoutValid(TimeSpan value)
195Assert.Equal(TimeSpan.MaxValue, new KestrelServerLimits { RequestHeadersTimeout = Timeout.InfiniteTimeSpan }.RequestHeadersTimeout);
200public void RequestHeadersTimeoutInvalid(TimeSpan value)
299Assert.Equal(TimeSpan.FromSeconds(5), new KestrelServerLimits().MinRequestBodyDataRate.GracePeriod);
307Assert.Equal(TimeSpan.FromSeconds(5), new KestrelServerLimits().MinResponseDataRate.GracePeriod);
357public static TheoryData<TimeSpan> TimeoutValidData => new TheoryData<TimeSpan>
359TimeSpan.FromTicks(1),
360TimeSpan.MaxValue,
363public static TheoryData<TimeSpan> TimeoutInvalidData => new TheoryData<TimeSpan>
365TimeSpan.MinValue,
366TimeSpan.FromTicks(-1),
367TimeSpan.Zero
TimeoutControlTests.cs (53)
33_timeoutControl.SetTimeout(TimeSpan.FromTicks(1), TimeoutReason.RequestHeaders);
63var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
94var gracePeriod = TimeSpan.FromSeconds(2);
155var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
164_timeProvider.Advance(TimeSpan.FromSeconds(1));
166_timeProvider.Advance(TimeSpan.FromSeconds(1));
168_timeProvider.Advance(TimeSpan.FromSeconds(1));
173_timeProvider.Advance(TimeSpan.FromSeconds(0.5));
177_timeProvider.Advance(TimeSpan.FromSeconds(0.5));
181_timeProvider.Advance(TimeSpan.FromSeconds(2));
188_timeProvider.Advance(TimeSpan.FromSeconds(0.5));
192_timeProvider.Advance(TimeSpan.FromSeconds(1.0));
194_timeProvider.Advance(TimeSpan.FromSeconds(.5));
201_timeProvider.Advance(TimeSpan.FromSeconds(1));
211var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
220_timeProvider.Advance(TimeSpan.FromSeconds(1));
222_timeProvider.Advance(TimeSpan.FromSeconds(1));
230_timeProvider.Advance(TimeSpan.FromSeconds(0.25));
234_timeProvider.Advance(TimeSpan.FromSeconds(0.25));
238_timeProvider.Advance(TimeSpan.FromSeconds(0.5));
246_timeProvider.Advance(TimeSpan.FromSeconds(1));
256var timeout = TimeSpan.FromSeconds(5);
257var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
268_timeProvider.Advance(TimeSpan.FromSeconds(3));
276_timeProvider.Advance(TimeSpan.FromSeconds(2) + Heartbeat.Interval + TimeSpan.FromTicks(1));
286var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
334var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
373var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
383AdvanceClock(TimeSpan.FromSeconds(4) + Heartbeat.Interval + TimeSpan.FromTicks(1));
391var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(5));
401AdvanceClock(TimeSpan.FromSeconds(1) + Heartbeat.Interval + TimeSpan.FromTicks(1));
407AdvanceClock(minRate.GracePeriod - TimeSpan.FromSeconds(1));
415var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
429AdvanceClock(TimeSpan.FromSeconds(5) + Heartbeat.Interval + TimeSpan.FromTicks(1));
438AdvanceClock(TimeSpan.FromSeconds(3));
446var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(5));
465AdvanceClock(Heartbeat.Interval + minRate.GracePeriod + TimeSpan.FromSeconds((numWrites - 1) * writeSize / minRate.BytesPerSecond));
470_timeProvider.Advance(TimeSpan.FromTicks(1));
479var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
489_timeProvider.Advance(TimeSpan.FromSeconds(4) + Heartbeat.Interval + TimeSpan.FromTicks(1));
495AdvanceClock(TimeSpan.FromSeconds(4) + TimeSpan.FromTicks(1));
502var gracePeriod = TimeSpan.FromSeconds(5);
515_timeProvider.Advance(TimeSpan.FromSeconds(1));
520private void AdvanceClock(TimeSpan timeSpan)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (4)
Microsoft.AspNetCore.Server.Kestrel.Tests (15)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (3)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (3)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (3)
Microsoft.AspNetCore.Session (13)
Microsoft.AspNetCore.Session.Tests (10)
Microsoft.AspNetCore.Shared.Tests (5)
Microsoft.AspNetCore.SignalR (1)
Microsoft.AspNetCore.SignalR.Client.Core (46)
Microsoft.AspNetCore.SignalR.Client.Tests (48)
Microsoft.AspNetCore.SignalR.Common.Tests (1)
Microsoft.AspNetCore.SignalR.Core (21)
Microsoft.AspNetCore.SignalR.Microbenchmarks (5)
Microsoft.AspNetCore.SignalR.Specification.Tests (19)
src\Shared\TaskExtensions.cs (13)
32public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
36return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
39public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
46return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
49public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
56return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
59public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
66return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
69public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
75public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
109public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
143private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (5)
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (16)
Docker.cs (14)
86RunProcessAndWait(_path, $"stop {_dockerContainerName}", "docker stop", logger, TimeSpan.FromSeconds(15), out var _);
91var wait = TimeSpan.FromSeconds(30);
96RunProcessAndWait(_path, $"logs {_dockerContainerName}", "docker logs", logger, TimeSpan.FromSeconds(5), out var logOutput);
115RunProcessAndThrowIfFailed(_path, $"run --rm -p 6379:6379 --name {_dockerContainerName} -d redis", "redis", logger, TimeSpan.FromMinutes(1));
124RunProcessAndWait(_path, $"stop {_dockerMonitorContainerName}", "docker stop", logger, TimeSpan.FromSeconds(15), out var _);
125RunProcessAndWait(_path, $"stop {_dockerContainerName}", "docker stop", logger, TimeSpan.FromSeconds(15), out var output);
131RunProcessAndWait(_path, "inspect --format=\"{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}\" " + _dockerContainerName, "docker ipaddress", logger, TimeSpan.FromSeconds(5), out output);
145RunProcessAndThrowIfFailed(_path, $"logs {_dockerContainerName}", "docker logs", logger, TimeSpan.FromSeconds(5));
148RunProcessAndWait(_path, $"stop {_dockerMonitorContainerName}", "docker stop", logger, TimeSpan.FromSeconds(15), out var _);
149RunProcessAndWait(_path, $"stop {_dockerContainerName}", "docker stop", logger, TimeSpan.FromSeconds(15), out var _);
157return RunProcessAndWait(_path, commandAndArguments, prefix, logger, TimeSpan.FromSeconds(30), out output);
160private static void RunProcessAndThrowIfFailed(string fileName, string arguments, string prefix, ILogger logger, TimeSpan timeout)
170private static int RunProcessAndWait(string fileName, string arguments, string prefix, ILogger logger, TimeSpan timeout, out string output)
Microsoft.AspNetCore.SignalR.Tests (22)
Microsoft.AspNetCore.SignalR.Tests.Utils (5)
Microsoft.AspNetCore.SpaProxy (4)
Microsoft.AspNetCore.SpaServices.Extensions (15)
Microsoft.AspNetCore.StaticAssets.Tests (3)
StaticAssetsIntegrationTests.cs (3)
586new("Last-Modified", new DateTimeOffset(2023,03,03,0,0,0,TimeSpan.Zero).ToString("ddd, dd MMM yyyy HH:mm:ss 'GMT'", CultureInfo.InvariantCulture))
766Assert.Equal(response.Content.Headers.LastModified.Value.Offset, TimeSpan.Zero);
1087public DateTimeOffset LastModified => new(2023, 03, 03, 0, 0, 0, TimeSpan.Zero);
Microsoft.AspNetCore.StaticFiles.FunctionalTests (3)
Microsoft.AspNetCore.StaticFiles.Tests (7)
StaticFileContextTest.cs (4)
43LastModified = new DateTimeOffset(2014, 1, 2, 3, 4, 5, TimeSpan.Zero)
69LastModified = new DateTimeOffset(2014, 1, 2, 3, 4, 5, TimeSpan.Zero)
98LastModified = new DateTimeOffset(2014, 1, 2, 3, 4, 5, TimeSpan.Zero)
125LastModified = new DateTimeOffset(2014, 1, 2, 3, 4, 5, TimeSpan.Zero)
Microsoft.AspNetCore.TestHost (9)
Microsoft.AspNetCore.TestHost.Tests (5)
Microsoft.AspNetCore.Testing.Tests (2)
Microsoft.AspNetCore.Tests (2)
Microsoft.AspNetCore.WebSockets (11)
Microsoft.AspNetCore.WebSockets.ConformanceTests (4)
Microsoft.AspNetCore.WebSockets.Tests (10)
Microsoft.Bcl.TimeProvider (7)
System\Threading\Tasks\TimeProviderTaskExtensions.cs (7)
44/// <param name="delay">The <see cref="TimeSpan"/> to wait before completing the returned task, or <see cref="Timeout.InfiniteTimeSpan"/> to wait indefinitely.</param>
49public static Task Delay(this TimeProvider timeProvider, TimeSpan delay, CancellationToken cancellationToken = default)
130public static Task WaitAsync(this Task task, TimeSpan timeout, TimeProvider timeProvider, CancellationToken cancellationToken = default)
221public static Task<TResult> WaitAsync<TResult>(this Task<TResult> task, TimeSpan timeout, TimeProvider timeProvider, CancellationToken cancellationToken = default)
231/// <summary>Initializes a new instance of the <see cref="CancellationTokenSource"/> class that will be canceled after the specified <see cref="TimeSpan"/>. </summary>
243/// If running on .NET versions earlier than .NET 8.0, there is a constraint when invoking <see cref="CancellationTokenSource.CancelAfter(TimeSpan)"/> on the resultant object.
247public static CancellationTokenSource CreateCancellationTokenSource(this TimeProvider timeProvider, TimeSpan delay)
Microsoft.Build (63)
TelemetryInfra\TelemetryForwarderProvider.cs (2)
58public void AddTask(string name, TimeSpan cumulativeExecutionTime, short executionsCount, long totalMemoryConsumed, bool isCustom, bool isFromNugetCache)
86public void AddTask(string name, TimeSpan cumulativeExecutionTime, short executionsCount, long totalMemoryConsumed, bool isCustom, bool isFromNugetCache) { }
Microsoft.Build.Engine.UnitTests (74)
BuildEventArgsSerialization_Tests.cs (13)
551TimeSpan span1 = TimeSpan.FromSeconds(5);
553TimeSpan span2 = TimeSpan.FromSeconds(15);
555TimeSpan span3 = TimeSpan.FromSeconds(50);
557Dictionary<string, TimeSpan> stats = new() { { key1, span1 }, { key2, span2 }, { key3, span3 } };
796new ProfiledLocation(TimeSpan.FromSeconds(1), TimeSpan.FromHours(2), 1)
800new ProfiledLocation(TimeSpan.FromSeconds(1), TimeSpan.FromHours(2), 2)
804new ProfiledLocation(TimeSpan.FromSeconds(1), TimeSpan.FromHours(2), 2)
Microsoft.Build.Framework (32)
Microsoft.Build.Framework.UnitTests (12)
BuildCheckTracingEventArgs_Tests.cs (9)
19TimeSpan span1 = TimeSpan.FromSeconds(5);
21TimeSpan span2 = TimeSpan.FromSeconds(15);
23TimeSpan span3 = TimeSpan.FromSeconds(50);
25Dictionary<string, TimeSpan> stats = new() { { key1, span1 }, { key2, span2 }, { key3, span3 } };
29new HashSet<string>() { "aa", "b" }, 5, 2, 8, true, TimeSpan.FromSeconds(123));
33new HashSet<string>(), 0, 0, 500, false, TimeSpan.FromSeconds(1234));
WorkerNodeTelemetryEventArgs_Tests.cs (3)
21{ (TaskOrTargetTelemetryKey)"task1", new TaskExecutionStats(TimeSpan.FromMinutes(1), 5, 1234) },
22{ (TaskOrTargetTelemetryKey)"task2", new TaskExecutionStats(TimeSpan.Zero, 0, 0) },
23{ (TaskOrTargetTelemetryKey)"task3", new TaskExecutionStats(TimeSpan.FromTicks(1234), 12, 987654321) }
Microsoft.Build.Tasks.Core (5)
Microsoft.Build.Tasks.UnitTests (16)
Microsoft.Build.UnitTests.Shared (3)
Microsoft.Build.Utilities.Core (5)
Microsoft.CodeAnalysis (93)
SourceGeneration\GeneratorDriver.cs (4)
40_state = new GeneratorDriverState(parseOptions, optionsProvider, generators, incrementalGenerators, additionalTexts, ImmutableArray.Create(new GeneratorState[generators.Length]), DriverStateTable.Empty, SyntaxStore.Empty, driverOptions, runtime: TimeSpan.Zero);
218return _state.With(stateTable: DriverStateTable.Empty, runTime: TimeSpan.Zero);
381private static GeneratorState SetGeneratorException(Compilation compilation, CommonMessageProvider provider, GeneratorState generatorState, ISourceGenerator generator, Exception e, DiagnosticBag? diagnosticBag, CancellationToken cancellationToken, TimeSpan? runTime = null, bool isInit = false)
394return generatorState.WithError(e, filtered, runTime ?? TimeSpan.Zero);
SourceGeneration\Nodes\NodeStateTable.cs (11)
194bool usedCachedEntry = builder.TryUseCachedEntries(TimeSpan.Zero, inputs);
269public bool TryRemoveEntries(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs)
285public bool TryRemoveEntries(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, out OneOrMany<T> entries)
297public bool TryUseCachedEntries(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs)
312internal bool TryUseCachedEntries(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, out TableEntry entry)
324public bool TryModifyEntry(T value, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState)
345public bool TryModifyEntries(ImmutableArray<T> outputs, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState)
437public bool TryModifyEntries(ImmutableArray<T> outputs, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState, out TableEntry entry)
449public void AddEntry(T value, EntryState state, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState)
456public TableEntry AddEntries(ImmutableArray<T> values, EntryState state, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState)
476private void RecordStepInfoForLastEntry(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState)
Microsoft.CodeAnalysis.Analyzers (10)
Microsoft.CodeAnalysis.AnalyzerUtilities (10)
Microsoft.CodeAnalysis.BannedApiAnalyzers (10)
Microsoft.CodeAnalysis.CodeStyle (10)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (18)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (4)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (70)
SourceGeneration\GeneratorDriverTests.cs (12)
571Assert.Equal(TimeSpan.Zero, result.ElapsedTime);
3529Assert.Equal(TimeSpan.Zero, timing.ElapsedTime);
3533Assert.Equal(TimeSpan.Zero, generatorTiming.ElapsedTime);
3559Assert.NotEqual(TimeSpan.Zero, timing.ElapsedTime);
3563Assert.NotEqual(TimeSpan.Zero, generatorTiming.ElapsedTime);
3599Assert.NotEqual(TimeSpan.Zero, timing.ElapsedTime);
3604Assert.NotEqual(TimeSpan.Zero, timing1.ElapsedTime);
3609Assert.NotEqual(TimeSpan.Zero, timing2.ElapsedTime);
3639Assert.NotEqual(TimeSpan.Zero, timing.ElapsedTime);
3643Assert.NotEqual(TimeSpan.Zero, generatorTiming.ElapsedTime);
3650Assert.NotEqual(TimeSpan.Zero, timing2.ElapsedTime);
3655Assert.NotEqual(TimeSpan.Zero, generatorTiming2.ElapsedTime);
SourceGeneration\StateTableTests.cs (54)
25builder.AddEntries(ImmutableArray.Create(1), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
26builder.AddEntries(ImmutableArray.Create(2), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
27builder.AddEntries(ImmutableArray.Create(3), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
38builder.AddEntries(ImmutableArray.Create(1, 2, 3), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
39builder.AddEntries(ImmutableArray.Create(4, 5, 6), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
40builder.AddEntries(ImmutableArray.Create(7, 8, 9), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
53builder.AddEntries(ImmutableArray.Create(o, o, o), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
66builder.AddEntry(o, EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
67builder.AddEntry(null, EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
68builder.AddEntry(o, EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
79builder.AddEntries(ImmutableArray.Create(1), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
80builder.AddEntries(ImmutableArray.Create(2, 3), EntryState.Cached, TimeSpan.Zero, default, EntryState.Cached);
81builder.AddEntries(ImmutableArray.Create(4, 5), EntryState.Modified, TimeSpan.Zero, default, EntryState.Modified);
82builder.AddEntries(ImmutableArray.Create(6), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
86builder.TryModifyEntries(ImmutableArray.Create(10, 11), TimeSpan.Zero, default, EntryState.Modified);
87builder.TryUseCachedEntries(TimeSpan.Zero, default, out var cachedEntries); // ((2, EntryState.Cached), (3, EntryState.Cached))
88builder.TryModifyEntries(ImmutableArray.Create(20, 21, 22), TimeSpan.Zero, default, EntryState.Modified);
89bool didRemoveEntries = builder.TryRemoveEntries(TimeSpan.Zero, default, out var removedEntries); //((6, EntryState.Removed))
110builder.AddEntries(ImmutableArray.Create(1, 2, 3), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
111builder.AddEntries(ImmutableArray.Create(4, 5, 6), EntryState.Removed, TimeSpan.Zero, default, EntryState.Removed);
112builder.AddEntries(ImmutableArray.Create(7, 8, 9), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
127builder.AddEntries(ImmutableArray.Create(1, 2, 3), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
128builder.AddEntries(ImmutableArray.Create(4, 5, 6), EntryState.Removed, TimeSpan.Zero, default, EntryState.Removed);
129builder.AddEntries(ImmutableArray.Create(7, 8, 9), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
148builder.AddEntries(ImmutableArray.Create(1), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
158builder.AddEntries(ImmutableArray.Create(1), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
166bool didRemoveEntries = builder.TryRemoveEntries(TimeSpan.Zero, default);
169builder.AddEntries(ImmutableArray.Create(2), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
180builder.AddEntries(ImmutableArray.Create(1, 2), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
181builder.AddEntries(ImmutableArray<int>.Empty, EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
182builder.AddEntries(ImmutableArray.Create(3, 4), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
189Assert.True(builder.TryModifyEntries(ImmutableArray.Create(3, 2), TimeSpan.Zero, default, EntryState.Modified));
190Assert.True(builder.TryModifyEntries(ImmutableArray<int>.Empty, TimeSpan.Zero, default, EntryState.Modified));
191Assert.True(builder.TryModifyEntries(ImmutableArray.Create(3, 5), TimeSpan.Zero, default, EntryState.Modified));
203builder.AddEntries(ImmutableArray.Create(1), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
204builder.AddEntries(ImmutableArray.Create(2), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
205builder.AddEntries(ImmutableArray.Create(3), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
206builder.AddEntries(ImmutableArray.Create(4), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
213Assert.True(builder.TryModifyEntry(1, TimeSpan.Zero, default, EntryState.Modified));
214Assert.True(builder.TryModifyEntry(2, TimeSpan.Zero, default, EntryState.Modified));
215Assert.True(builder.TryModifyEntry(5, TimeSpan.Zero, default, EntryState.Modified));
216Assert.True(builder.TryModifyEntry(4, TimeSpan.Zero, default, EntryState.Modified));
228builder.AddEntries(ImmutableArray.Create(1), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
229builder.AddEntries(ImmutableArray.Create(2), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
230builder.AddEntries(ImmutableArray.Create(3), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
237Assert.True(builder.TryModifyEntry(1, TimeSpan.Zero, default, EntryState.Modified)); // ((1, EntryState.Cached))
238Assert.True(builder.TryModifyEntry(4, TimeSpan.Zero, default, EntryState.Modified)); // ((4, EntryState.Modified))
239Assert.True(builder.TryModifyEntry(5, TimeSpan.Zero, default, EntryState.Modified)); // ((3, EntryState.Cached))
282nodeBuilder.AddEntries(ImmutableArray.Create(1, 2, 3), EntryState.Cached, TimeSpan.Zero, default, EntryState.Cached);
311nodeBuilder.AddEntries(ImmutableArray.Create(1, 2, 3), EntryState.Added, TimeSpan.Zero, emptyInputSteps, EntryState.Added);
312nodeBuilder.AddEntries(ImmutableArray.Create(4), EntryState.Removed, TimeSpan.Zero, emptyInputSteps, EntryState.Removed);
313nodeBuilder.AddEntries(ImmutableArray.Create(5, 6), EntryState.Modified, TimeSpan.Zero, emptyInputSteps, EntryState.Modified);
600builder.AddEntry(value, state, TimeSpan.Zero, default, state);
1357runtime: TimeSpan.Zero);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Microsoft.CodeAnalysis.EditorFeatures (23)
src\Workspaces\Remote\ServiceHub\Services\EditAndContinue\EditAndContinueLogReporter.cs (1)
33delay: TimeSpan.Zero,
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (17)
Microsoft.CodeAnalysis.ExternalAccess.Apex (2)
Microsoft.CodeAnalysis.ExternalAccess.FSharp (2)
Microsoft.CodeAnalysis.Features (114)
Copilot\CopilotChangeAnalysis.cs (8)
24[property: DataMember(Order = 7)] TimeSpan TotalAnalysisTime,
25[property: DataMember(Order = 8)] TimeSpan ForkingTime,
26[property: DataMember(Order = 9)] TimeSpan TotalDiagnosticComputationTime,
38[property: DataMember(Order = 1)] TimeSpan ComputationTime,
52[property: DataMember(Order = 0)] TimeSpan TotalComputationTime,
53[property: DataMember(Order = 1)] TimeSpan TotalApplicationTime,
55[property: DataMember(Order = 3)] Dictionary<string, TimeSpan> DiagnosticIdToApplicationTime,
57[property: DataMember(Order = 5)] Dictionary<string, TimeSpan> ProviderNameToApplicationTime,
ExternalAccess\UnitTesting\Notification\AbstractGlobalOperationNotificationService.cs (1)
33TimeSpan.Zero,
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs (1)
33TimeSpan backOffTimeSpan,
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs (1)
32TimeSpan backOffTimeSpan,
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs (1)
48TimeSpan backOffTimeSpan,
Microsoft.CodeAnalysis.InteractiveHost (7)
Microsoft.CodeAnalysis.LanguageServer (4)
Microsoft.CodeAnalysis.LanguageServer.Protocol (6)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (7)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (10)
Microsoft.CodeAnalysis.PublicApiAnalyzers (10)
Microsoft.CodeAnalysis.Remote.ServiceHub (18)
Services\DiagnosticAnalyzer\PerformanceQueue.cs (8)
38public void Add(IEnumerable<(string analyzerId, TimeSpan timeSpan)> rawData, int unitCount)
134public Snapshot(IEnumerable<(string analyzerId, TimeSpan timeSpan)> snapshot, int unitCount)
139public Snapshot(IEnumerable<(int assignedAnalyzerNumber, TimeSpan timeSpan)> rawData, int unitCount)
146public void Update(IEnumerable<(string analyzerId, TimeSpan timeSpan)> rawData, int unitCount)
163Dictionary<int, double> map, IEnumerable<(int assignedAnalyzerNumber, TimeSpan timeSpan)> rawData, int fileCount)
166var minSpan = rawData.Select(kv => kv.timeSpan).Min();
180private static IEnumerable<(int assignedAnalyzerNumber, TimeSpan timeSpan)> Convert(IEnumerable<(string analyzerId, TimeSpan timeSpan)> rawData)
Microsoft.CodeAnalysis.ResxSourceGenerator (10)
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (1)
Microsoft.CodeAnalysis.Test.Utilities (3)
Microsoft.CodeAnalysis.Threading.Package (7)
Microsoft.CodeAnalysis.Workspaces (41)
Workspace\Solution\VersionSource\RecoverableTextAndVersion.RecoverableText.cs (1)
29new(TimeSpan.Zero,
Microsoft.CodeAnalysis.Workspaces.MSBuild (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (3)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (3)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
Microsoft.DotNet.Arcade.Sdk (1)
Microsoft.DotNet.ArcadeAzureIntegration (2)
Microsoft.DotNet.Build.Tasks.Feed (9)
Microsoft.DotNet.Build.Tasks.Installers (3)
Microsoft.DotNet.Helix.Client (1)
Microsoft.DotNet.Helix.JobSender (8)
Microsoft.DotNet.Helix.Sdk (31)
Microsoft.DotNet.Internal.SymbolHelper (5)
Microsoft.DotNet.Open.Api.Tools.Tests (9)
Microsoft.DotNet.SignCheckTask (2)
Microsoft.DotNet.SignTool (1)
Microsoft.DotNet.XliffTasks (3)
Microsoft.DotNet.XUnitAssert.Tests (39)
EqualityAssertsTests.cs (34)
1762 var precision = TimeSpan.FromMinutes(1);
1777 var precision = TimeSpan.FromMinutes(1);
1778 var difference = TimeSpan.FromMinutes(2);
1812 var expected = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1813 var actual = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1826 var expected = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1827 var actual = new DateTimeOffset(2023, 2, 11, 15, 5, 0, TimeSpan.Zero);
1846 var expected = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1847 var actual = new DateTimeOffset(2023, 2, 11, 16, 4, 0, TimeSpan.FromHours(1));
1859 var expected = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1860 var actual = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.FromHours(1));
1879 var date1 = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1880 var date2 = new DateTimeOffset(2023, 2, 11, 15, 5, 0, TimeSpan.Zero);
1881 var precision = TimeSpan.FromMinutes(1);
1894 var date1 = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1895 var date2 = new DateTimeOffset(2023, 2, 11, 15, 6, 0, TimeSpan.Zero);
1896 var precision = TimeSpan.FromMinutes(1);
1897 var difference = TimeSpan.FromMinutes(2);
1928 var date1 = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1929 var date2 = new DateTimeOffset(2023, 2, 11, 16, 5, 0, TimeSpan.FromHours(1));
1930 var precision = TimeSpan.FromMinutes(1);
1943 var date1 = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1944 var date2 = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.FromHours(1));
1945 var precision = TimeSpan.FromMinutes(1);
1946 var difference = TimeSpan.FromHours(1);
EquivalenceAssertsTests.cs (4)
1503 var expected = new DateTimeOffset(2022, 12, 1, 1, 3, 1, TimeSpan.Zero);
1504 var actual = new DateTimeOffset(2022, 12, 1, 1, 3, 1, TimeSpan.Zero);
1512 var expected = new DateTimeOffset(2022, 12, 1, 1, 3, 1, TimeSpan.Zero);
1513 var actual = new DateTimeOffset(2011, 9, 13, 18, 22, 0, TimeSpan.Zero);
Microsoft.Extensions.AI (4)
Microsoft.Extensions.AI.Abstractions (5)
Microsoft.Extensions.AI.Abstractions.Tests (51)
ChatCompletion\ChatResponseTests.cs (6)
61response.CreatedAt = new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero);
62Assert.Equal(new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero), response.CreatedAt);
91CreatedAt = new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero),
108Assert.Equal(new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero), result.CreatedAt);
135CreatedAt = new DateTimeOffset(2024, 11, 10, 9, 20, 0, TimeSpan.Zero),
148Assert.Equal(new DateTimeOffset(2024, 11, 10, 9, 20, 0, TimeSpan.Zero), update0.CreatedAt);
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (3)
31new(ChatRole.Assistant, "Hello") { ResponseId = "someResponse", MessageId = "12345", CreatedAt = new DateTimeOffset(1, 2, 3, 4, 5, 6, TimeSpan.Zero), ModelId = "model123" },
33new(null, "world!") { CreatedAt = new DateTimeOffset(2, 2, 3, 4, 5, 6, TimeSpan.Zero), ConversationId = "123", AdditionalProperties = new() { ["c"] = "d" } },
49Assert.Equal(new DateTimeOffset(2, 2, 3, 4, 5, 6, TimeSpan.Zero), response.CreatedAt);
ChatCompletion\ChatResponseUpdateTests.cs (4)
76update.CreatedAt = new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero);
77Assert.Equal(new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero), update.CreatedAt);
130CreatedAt = new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero),
161Assert.Equal(new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero), result.CreatedAt);
SpeechToText\SpeechToTextResponseUpdateExtensionsTests.cs (12)
49new("human, ") { ModelId = "model123", StartTime = TimeSpan.FromSeconds(10), EndTime = TimeSpan.FromSeconds(20) },
50new("How ") { ModelId = "model123", StartTime = TimeSpan.FromSeconds(22), EndTime = TimeSpan.FromSeconds(23) },
51new("are ") { ModelId = "model123", StartTime = TimeSpan.FromSeconds(23), EndTime = TimeSpan.FromSeconds(24) },
52new([new TextContent("You?")]) { ModelId = "model123", StartTime = TimeSpan.FromSeconds(24), EndTime = TimeSpan.FromSeconds(25), AdditionalProperties = new() { ["c"] = "d" } },
53new() { ResponseId = "someResponse", ModelId = "model123", StartTime = TimeSpan.FromSeconds(25), EndTime = TimeSpan.FromSeconds(35) },
63Assert.Equal(TimeSpan.FromSeconds(10), response.StartTime);
64Assert.Equal(TimeSpan.FromSeconds(35), response.EndTime);
Microsoft.Extensions.AI.Evaluation (8)
Microsoft.Extensions.AI.Evaluation.NLP (6)
Microsoft.Extensions.AI.Evaluation.Quality (21)
Microsoft.Extensions.AI.Evaluation.Reporting (16)
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (11)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (11)
Microsoft.Extensions.AI.Evaluation.Safety (8)
Microsoft.Extensions.AI.Integration.Tests (1)
Microsoft.Extensions.AI.OpenAI (16)
Microsoft.Extensions.AI.Templates.Tests (4)
Microsoft.Extensions.AI.Tests (1)
Microsoft.Extensions.ApiDescription.Client.Tests (13)
Microsoft.Extensions.Caching.Abstractions (25)
Microsoft.Extensions.Caching.Hybrid (19)
Internal\HybridCachePayload.cs (3)
104string key, long creationTime, TimeSpan duration, PayloadFlags flags, TagSet tags, ReadOnlySequence<byte> payload)
179out ArraySegment<byte> payload, out TimeSpan remainingTime, out PayloadFlags flags, out ushort entropy, out TagSet pendingTags, out Exception? fault)
187remainingTime = TimeSpan.Zero;
Microsoft.Extensions.Caching.Hybrid.Tests (50)
BufferReleaseTests.cs (2)
133var bytes = HybridCachePayload.Write(arr, key, cache.CurrentTimestamp(), TimeSpan.FromHours(1), 0, TagSet.Empty, writer.AsSequence());
196var bytes = HybridCachePayload.Write(arr, key, cache.CurrentTimestamp(), TimeSpan.FromHours(1), 0, TagSet.Empty, writer.AsSequence());
PayloadTests.cs (21)
50int actualLength = HybridCachePayload.Write(oversized, key, cache.CurrentTimestamp(), TimeSpan.FromMinutes(1), 0, tags, new(bytes));
55clock.Add(TimeSpan.FromSeconds(10));
56var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
80int actualLength = HybridCachePayload.Write(oversized, key, cache.CurrentTimestamp(), TimeSpan.FromMinutes(1), 0, tags, new(bytes));
84clock.Add(TimeSpan.FromSeconds(58));
85var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
90clock.Add(TimeSpan.FromSeconds(4));
114int actualLength = HybridCachePayload.Write(oversized, key, cache.CurrentTimestamp(), TimeSpan.FromMinutes(1), 0, tags, new(bytes));
118clock.Add(TimeSpan.FromSeconds(2));
121var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
144int actualLength = HybridCachePayload.Write(oversized, key, cache.CurrentTimestamp(), TimeSpan.FromMinutes(1), 0, tags, new(bytes));
148clock.Add(TimeSpan.FromSeconds(2));
151var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
181int actualLength = HybridCachePayload.Write(oversized, key, creation, TimeSpan.FromMinutes(1), 0, tags, new(bytes));
185clock.Add(TimeSpan.FromSeconds(2));
189var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
211var result = HybridCachePayload.TryParse(new(bytes), "whatever", TagSet.Empty, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
234int actualLength = HybridCachePayload.Write(oversized, key, cache.CurrentTimestamp(), TimeSpan.FromMinutes(1), 0, tags, new(bytes));
238var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength - 1), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
261int actualLength = HybridCachePayload.Write(oversized, key, cache.CurrentTimestamp(), TimeSpan.FromMinutes(1), 0, tags, new(bytes));
265var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength + 1), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
Microsoft.Extensions.Caching.Memory (9)
Microsoft.Extensions.Caching.MicroBenchmarks (2)
Microsoft.Extensions.Caching.SqlServer (12)
Microsoft.Extensions.Caching.SqlServer.Tests (46)
Microsoft.Extensions.Caching.StackExchangeRedis (23)
RedisCache.cs (23)
63private readonly TimeSpan ReconnectMinInterval = TimeSpan.FromSeconds(60);
66private readonly TimeSpan ReconnectErrorThreshold = TimeSpan.FromSeconds(30);
71return ticks == 0 ? DateTimeOffset.MinValue : new DateTimeOffset(ticks, TimeSpan.Zero);
188var setTtl = batch.KeyExpireAsync(prefixedKey, TimeSpan.FromSeconds(ttl.GetValueOrDefault()));
237cache.KeyExpireAsync(prefixedKey, TimeSpan.FromSeconds(ttl.GetValueOrDefault()))
249private static HashEntry[] GetHashFields(RedisValue value, DateTimeOffset? absoluteExpiration, TimeSpan? slidingExpiration)
413MapMetadata(results, out DateTimeOffset? absExpr, out TimeSpan? sldExpr);
452MapMetadata(results, out DateTimeOffset? absExpr, out TimeSpan? sldExpr);
503private static void MapMetadata(RedisValue[] results, out DateTimeOffset? absoluteExpiration, out TimeSpan? slidingExpiration)
510absoluteExpiration = new DateTimeOffset(absoluteExpirationTicks.Value, TimeSpan.Zero);
519private void Refresh(IDatabase cache, string key, DateTimeOffset? absExpr, TimeSpan sldExpr)
524TimeSpan? expr;
527var relExpr = absExpr.Value - DateTimeOffset.Now;
545private async Task RefreshAsync(IDatabase cache, string key, DateTimeOffset? absExpr, TimeSpan sldExpr, CancellationToken token)
552TimeSpan? expr;
555var relExpr = absExpr.Value - DateTimeOffset.Now;
639TimeSpan elapsedSinceLastReconnect = utcNow - previousConnectTime;
656TimeSpan elapsedSinceFirstError = utcNow - firstErrorTime;
657TimeSpan elapsedSinceMostRecentError = utcNow - ReadTimeTicks(ref _previousErrorTimeTicks);
731MapMetadata(metadata, out DateTimeOffset? absExpr, out TimeSpan? sldExpr);
778MapMetadata(metadata, out DateTimeOffset? absExpr, out TimeSpan? sldExpr);
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (50)
TimeExpirationAsyncTests.cs (25)
44var expected = DateTimeOffset.Now - TimeSpan.FromMinutes(1);
62await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(1)));
69await Task.Delay(TimeSpan.FromSeconds(0.5));
83await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(0.25)));
98await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(-1)));
102TimeSpan.FromMinutes(-1));
114await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.Zero));
118TimeSpan.Zero);
128await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(1)));
135await Task.Delay(TimeSpan.FromSeconds(0.5));
148await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(0.25)));
163await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(-1)));
164}, nameof(DistributedCacheEntryOptions.SlidingExpiration), "The sliding expiration value must be positive.", TimeSpan.FromMinutes(-1));
176await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.Zero));
180TimeSpan.Zero);
190await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(1)));
195await Task.Delay(TimeSpan.FromSeconds(3.5));
208await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(0.25)));
221await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(1)));
228await Task.Delay(TimeSpan.FromSeconds(0.5));
234await Task.Delay(TimeSpan.FromSeconds(3));
247.SetSlidingExpiration(TimeSpan.FromSeconds(1))
248.SetAbsoluteExpiration(TimeSpan.FromSeconds(3)));
256await Task.Delay(TimeSpan.FromSeconds(0.5));
265await Task.Delay(TimeSpan.FromSeconds(0.5));
TimeExpirationTests.cs (25)
27var expected = DateTimeOffset.Now - TimeSpan.FromMinutes(1);
45cache.Set(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(1)));
52Thread.Sleep(TimeSpan.FromSeconds(0.5));
66cache.Set(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(0.25)));
81cache.Set(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(-1)));
85TimeSpan.FromMinutes(-1));
98cache.Set(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.Zero));
102TimeSpan.Zero);
112cache.Set(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(1)));
119Thread.Sleep(TimeSpan.FromSeconds(0.5));
132cache.Set(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(0.25)));
147cache.Set(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(-1)));
148}, nameof(DistributedCacheEntryOptions.SlidingExpiration), "The sliding expiration value must be positive.", TimeSpan.FromMinutes(-1));
161cache.Set(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.Zero));
165TimeSpan.Zero);
175cache.Set(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(1)));
180Thread.Sleep(TimeSpan.FromSeconds(3.5));
193cache.Set(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(0.25)));
206cache.Set(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(1)));
213Thread.Sleep(TimeSpan.FromSeconds(0.5));
219Thread.Sleep(TimeSpan.FromSeconds(3));
232.SetSlidingExpiration(TimeSpan.FromSeconds(1))
233.SetAbsoluteExpiration(TimeSpan.FromSeconds(3)));
241Thread.Sleep(TimeSpan.FromSeconds(0.5));
250Thread.Sleep(TimeSpan.FromSeconds(0.5));
Microsoft.Extensions.Compliance.Redaction (10)
Microsoft.Extensions.Compliance.Testing (1)
Microsoft.Extensions.Configuration.KeyPerFile.Tests (1)
Microsoft.Extensions.Diagnostics (2)
Microsoft.Extensions.Diagnostics.HealthChecks (49)
HealthCheckPublisherHostedService.cs (15)
53private (TimeSpan Delay, TimeSpan Period) GetTimerOptions(HealthCheckRegistration registration)
107var delayPeriodGroups = new HashSet<(TimeSpan Delay, TimeSpan Period)>();
124private Timer CreateTimer((TimeSpan Delay, TimeSpan Period) timerOptions)
144internal async Task RunAsync((TimeSpan Delay, TimeSpan Period) timerOptions)
152var timeout = _healthCheckPublisherOptions.Value.Timeout;
178private async Task RunAsyncCore((TimeSpan Delay, TimeSpan Period) timerOptions, CancellationToken cancellationToken)
255public static void HealthCheckPublisherProcessingEnd(ILogger logger, TimeSpan duration, Exception? exception = null) =>
264public static void HealthCheckPublisherEnd(ILogger logger, IHealthCheckPublisher HealthCheckPublisher, TimeSpan duration) =>
270public static void HealthCheckPublisherError(ILogger logger, IHealthCheckPublisher publisher, TimeSpan duration, Exception exception) =>
277public static void HealthCheckPublisherTimeout(ILogger logger, IHealthCheckPublisher publisher, TimeSpan duration) =>
Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (17)
HealthReportEntry.cs (3)
26public HealthReportEntry(HealthStatus status, string? description, TimeSpan duration, Exception? exception, IReadOnlyDictionary<string, object>? data)
41public HealthReportEntry(HealthStatus status, string? description, TimeSpan duration, Exception? exception, IReadOnlyDictionary<string, object>? data, IEnumerable<string>? tags = null)
64public TimeSpan Duration { get; }
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (2)
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (72)
HealthCheckPublisherHostedServiceTest.cs (59)
112options.Delay = TimeSpan.FromMilliseconds(0);
120await publishers[0].Started.TimeoutAfter(TimeSpan.FromSeconds(10));
121await publishers[1].Started.TimeoutAfter(TimeSpan.FromSeconds(10));
122await publishers[2].Started.TimeoutAfter(TimeSpan.FromSeconds(10));
158await publisher.Started.TimeoutAfter(TimeSpan.FromSeconds(10));
171await running.TimeoutAfter(TimeSpan.FromSeconds(10));
200await publisher.Started.TimeoutAfter(TimeSpan.FromSeconds(10));
204await running.TimeoutAfter(TimeSpan.FromSeconds(10));
263Delay = TimeSpan.FromSeconds(1),
264Period = TimeSpan.FromSeconds(9)
275Delay = TimeSpan.FromSeconds(1),
276Period = TimeSpan.FromSeconds(9)
287Delay = TimeSpan.FromSeconds(1),
288Period = TimeSpan.FromSeconds(18)
303Delay = TimeSpan.FromSeconds(2),
304Period = TimeSpan.FromSeconds(18)
315Delay = TimeSpan.FromSeconds(7),
316Period = TimeSpan.FromSeconds(11)
327Delay = TimeSpan.FromSeconds(9),
328Period = TimeSpan.FromSeconds(5)
339Delay = TimeSpan.FromSeconds(10),
340Period = TimeSpan.FromSeconds(8)
351Delay = TimeSpan.FromSeconds(10),
352Period = TimeSpan.FromSeconds(9)
360await publisher.Started.TimeoutAfter(TimeSpan.FromSeconds(10));
367await running.TimeoutAfter(TimeSpan.FromSeconds(10));
373await unblockDelayedCheck.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
418await publishers[0].Started.TimeoutAfter(TimeSpan.FromSeconds(10));
419await publishers[1].Started.TimeoutAfter(TimeSpan.FromSeconds(10));
420await publishers[2].Started.TimeoutAfter(TimeSpan.FromSeconds(10));
426await running.TimeoutAfter(TimeSpan.FromSeconds(10));
464await publisher.Started.TimeoutAfter(TimeSpan.FromSeconds(10));
472await running.TimeoutAfter(TimeSpan.FromSeconds(10));
519options.Delay = TimeSpan.Zero;
538Delay = TimeSpan.FromSeconds(1),
539Period = TimeSpan.FromSeconds(9)
550Delay = TimeSpan.FromSeconds(1),
551Period = TimeSpan.FromSeconds(9)
562Delay = TimeSpan.FromSeconds(1),
563Period = TimeSpan.FromSeconds(9)
578Delay = TimeSpan.FromSeconds(2),
579Period = TimeSpan.FromSeconds(18)
590Delay = TimeSpan.FromSeconds(7),
591Period = TimeSpan.FromSeconds(11)
602Delay = TimeSpan.FromSeconds(9),
603Period = TimeSpan.FromSeconds(5)
614Delay = TimeSpan.FromSeconds(10),
615Period = TimeSpan.FromSeconds(8)
626Delay = TimeSpan.FromSeconds(10),
627Period = TimeSpan.FromSeconds(9)
636await unblockDelayedCheck.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
681await RunServiceAsync(service).TimeoutAfter(TimeSpan.FromSeconds(10));
725await RunServiceAsync(service).TimeoutAfter(TimeSpan.FromSeconds(10));
761options.Delay = TimeSpan.FromMinutes(5);
762options.Period = TimeSpan.FromMinutes(5);
763options.Timeout = TimeSpan.FromMinutes(5);
788private Task RunServiceAsync(HealthCheckPublisherHostedService service) => service.RunAsync((TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)));
792await Assert.ThrowsAsync<TaskCanceledException>(() => Task.Delay(TimeSpan.FromSeconds(10), cancellationToken));
HealthReportTest.cs (10)
22{"Foo", new HealthReportEntry(HealthStatus.Healthy, null,TimeSpan.MinValue, null, null) },
23{"Bar", new HealthReportEntry(HealthStatus.Healthy, null, TimeSpan.MinValue,null, null) },
24{"Baz", new HealthReportEntry(status, exception: null, description: null,duration:TimeSpan.MinValue, data: null) },
25{"Quick", new HealthReportEntry(HealthStatus.Healthy, null, TimeSpan.MinValue, null, null) },
26{"Quack", new HealthReportEntry(HealthStatus.Healthy, null, TimeSpan.MinValue, null, null) },
27{"Quock", new HealthReportEntry(HealthStatus.Healthy, null, TimeSpan.MinValue, null, null) },
28}, totalDuration: TimeSpan.MinValue);
41{"Foo", new HealthReportEntry(HealthStatus.Healthy, null,TimeSpan.MinValue, null, null) }
42}, totalDuration: TimeSpan.FromMilliseconds(milliseconds));
44Assert.Equal(TimeSpan.FromMilliseconds(milliseconds), result.TotalDuration);
Microsoft.Extensions.Diagnostics.Probes (11)
Microsoft.Extensions.Diagnostics.Probes.Tests (8)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (49)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (193)
CalculatorTests.cs (26)
19totalTimeSinceStart: TimeSpan.FromTicks(new FakeTimeProvider().GetUtcNow().Ticks),
20kernelTimeSinceStart: TimeSpan.FromTicks(0),
21userTimeSinceStart: TimeSpan.FromTicks(0),
31TimeSpan secondSnapshotTimeSpan = _firstSnapshot.TotalTimeSinceStart.Add(TimeSpan.FromSeconds(5));
40kernelTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks / 4),
43userTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks / 4),
66TimeSpan secondSnapshotTimeSpan = _firstSnapshot.TotalTimeSinceStart.Add(TimeSpan.FromSeconds(5));
75kernelTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks / 4),
78userTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks / 4),
95totalTimeSinceStart: _firstSnapshot.TotalTimeSinceStart.Add(TimeSpan.FromSeconds(5)),
122totalTimeSinceStart: TimeSpan.FromTicks(new FakeTimeProvider().GetUtcNow().Ticks),
123kernelTimeSinceStart: TimeSpan.FromTicks(1000),
124userTimeSinceStart: TimeSpan.FromTicks(1000),
127totalTimeSinceStart: firstSnapshot.TotalTimeSinceStart.Add(TimeSpan.FromSeconds(5)),
129kernelTimeSinceStart: TimeSpan.FromTicks(firstSnapshot.KernelTimeSinceStart.Ticks - 1),
130userTimeSinceStart: TimeSpan.FromTicks(firstSnapshot.UserTimeSinceStart.Ticks - 1));
144TimeSpan secondSnapshotTimeSpan = _firstSnapshot.TotalTimeSinceStart.Add(TimeSpan.FromSeconds(5));
151kernelTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks / 2),
152userTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks / 2),
175TimeSpan secondSnapshotTimeSpan = _firstSnapshot.TotalTimeSinceStart.Add(TimeSpan.FromSeconds(5));
185kernelTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks),
186userTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks),
ResourceMonitoringOptionsValidatorTests.cs (15)
17CollectionWindow = TimeSpan.FromMilliseconds(100),
18SamplingInterval = TimeSpan.FromMilliseconds(10),
19PublishingWindow = TimeSpan.FromSeconds(200)
34CollectionWindow = TimeSpan.FromTicks(1),
35SamplingInterval = TimeSpan.FromSeconds(1),
36PublishingWindow = TimeSpan.FromSeconds(200)
49CollectionWindow = TimeSpan.FromMilliseconds(100),
50SamplingInterval = TimeSpan.FromMilliseconds(0),
51PublishingWindow = TimeSpan.FromSeconds(200)
64CollectionWindow = TimeSpan.FromMilliseconds(100),
65SamplingInterval = TimeSpan.FromMilliseconds(1),
66PublishingWindow = TimeSpan.FromSeconds(-5)
109CollectionWindow = TimeSpan.FromMilliseconds(samplingWindow),
110SamplingInterval = TimeSpan.FromMilliseconds(samplingPeriod),
111PublishingWindow = TimeSpan.FromMilliseconds(calculationPeriod)
ResourceMonitoringServiceTests.cs (80)
112CollectionWindow = TimeSpan.FromMilliseconds(int.MaxValue),
113SamplingInterval = TimeSpan.FromMilliseconds(int.MaxValue)
170CollectionWindow = TimeSpan.FromSeconds(1),
171PublishingWindow = TimeSpan.FromSeconds(1)
202CollectionWindow = TimeSpan.FromMilliseconds(TimerPeriod),
203SamplingInterval = TimeSpan.FromMilliseconds(TimerPeriod),
204PublishingWindow = TimeSpan.FromMilliseconds(TimerPeriod)
217await Task.Delay(TimeSpan.FromMilliseconds(TimerPeriod * 3));
243CollectionWindow = TimeSpan.FromMilliseconds(100),
244PublishingWindow = TimeSpan.FromMilliseconds(100),
245SamplingInterval = TimeSpan.FromMilliseconds(1)
258clock.Advance(TimeSpan.FromMilliseconds(1));
259clock.Advance(TimeSpan.FromMilliseconds(1));
276CollectionWindow = TimeSpan.FromMilliseconds(100),
277PublishingWindow = TimeSpan.FromMilliseconds(100)
317CollectionWindow = TimeSpan.FromMilliseconds(TimerPeriod),
318PublishingWindow = TimeSpan.FromMilliseconds(TimerPeriod),
319SamplingInterval = TimeSpan.FromMilliseconds(TimerPeriod)
338clock.Advance(TimeSpan.FromMilliseconds(TimerPeriod));
360CollectionWindow = TimeSpan.FromMilliseconds(TimerPeriod),
361PublishingWindow = TimeSpan.FromMilliseconds(TimerPeriod),
362SamplingInterval = TimeSpan.FromMilliseconds(TimerPeriod)
370clock.Advance(TimeSpan.FromMilliseconds(TimerPeriod));
388TimeSpan.FromTicks(clock.GetUtcNow().Ticks),
389TimeSpan.Zero,
390TimeSpan.Zero,
402TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod).Ticks),
403TimeSpan.FromMilliseconds(250),
404TimeSpan.FromMilliseconds(250),
407TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 2).Ticks),
408TimeSpan.FromMilliseconds(250),
409TimeSpan.FromMilliseconds(250),
412TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 3).Ticks),
413TimeSpan.FromMilliseconds(250),
414TimeSpan.FromMilliseconds(250),
417TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 4).Ticks),
418TimeSpan.FromMilliseconds(250),
419TimeSpan.FromMilliseconds(250),
422TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 5).Ticks),
423TimeSpan.FromMilliseconds(250),
424TimeSpan.FromMilliseconds(250),
437CollectionWindow = TimeSpan.FromMilliseconds(TimerPeriod * 2),
438PublishingWindow = TimeSpan.FromMilliseconds(TimerPeriod * 2),
439SamplingInterval = TimeSpan.FromMilliseconds(TimerPeriod)
465clock.Advance(TimeSpan.FromMilliseconds(TimerPeriod));
471clock.Advance(TimeSpan.FromTicks(1));
495TimeSpan.FromTicks(clock.GetUtcNow().Ticks),
496TimeSpan.FromMilliseconds(250),
497TimeSpan.FromMilliseconds(250),
508TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod).Ticks),
509TimeSpan.FromMilliseconds(250),
510TimeSpan.FromMilliseconds(250),
513TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 2).Ticks),
514TimeSpan.FromMilliseconds(250),
515TimeSpan.FromMilliseconds(250),
518TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 3).Ticks),
519TimeSpan.FromMilliseconds(250),
520TimeSpan.FromMilliseconds(250),
523TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 4).Ticks),
524TimeSpan.FromMilliseconds(250),
525TimeSpan.FromMilliseconds(250),
528TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 5).Ticks),
529TimeSpan.FromMilliseconds(250),
530TimeSpan.FromMilliseconds(250),
546CollectionWindow = TimeSpan.FromMilliseconds(TimerPeriod * 2),
547PublishingWindow = TimeSpan.FromMilliseconds(TimerPeriod * 2),
548SamplingInterval = TimeSpan.FromMilliseconds(TimerPeriod)
574clock.Advance(TimeSpan.FromMilliseconds(TimerPeriod));
643TimeSpan.FromTicks(_clock.GetUtcNow().Ticks),
644TimeSpan.FromSeconds(1),
645TimeSpan.FromSeconds(1),
653CollectionWindow = TimeSpan.FromSeconds(1),
654SamplingInterval = TimeSpan.FromMilliseconds(100),
655PublishingWindow = TimeSpan.FromSeconds(1)
663var exception = Record.Exception(() => _ = tracker.GetUtilization(TimeSpan.FromSeconds(1)));
678CollectionWindow = TimeSpan.FromSeconds(6),
679PublishingWindow = TimeSpan.FromSeconds(5)
687var exception = Record.Exception(() => tracker.GetUtilization(TimeSpan.FromSeconds(6)));
702CollectionWindow = TimeSpan.FromSeconds(5)
710var exception = Record.Exception(() => tracker.GetUtilization(TimeSpan.FromSeconds(6)));
SnapshotTests.cs (9)
18var snapshot = new Snapshot(TimeSpan.FromTicks(time.GetUtcNow().Ticks), TimeSpan.Zero, TimeSpan.FromSeconds(1), 10);
22snapshot = new Snapshot(time, TimeSpan.Zero, TimeSpan.FromSeconds(1), 10);
30=> new Snapshot(new FakeTimeProvider(), TimeSpan.MinValue, TimeSpan.FromSeconds(1), 1000));
37=> new Snapshot(new FakeTimeProvider(), TimeSpan.Zero, TimeSpan.MinValue, 1000));
Microsoft.Extensions.Diagnostics.Testing (1)
Microsoft.Extensions.Diagnostics.Testing.Tests (15)
Microsoft.Extensions.FileProviders.Physical (7)
Microsoft.Extensions.Hosting (5)
Microsoft.Extensions.Hosting.Abstractions (1)
Microsoft.Extensions.Hosting.Testing (7)
Microsoft.Extensions.Hosting.Testing.Tests (10)
Microsoft.Extensions.Http (37)
Logging\LogHelper.cs (4)
87public static void LogRequestEnd(this ILogger logger, HttpResponseMessage response, TimeSpan duration, Func<string, bool> shouldRedactHeaderValue)
102public static void LogRequestFailed(this ILogger logger, TimeSpan duration, HttpRequestException exception) =>
126public static void LogRequestPipelineEnd(this ILogger logger, HttpResponseMessage response, TimeSpan duration, Func<string, bool> shouldRedactHeaderValue)
141public static void LogRequestPipelineFailed(this ILogger logger, TimeSpan duration, HttpRequestException exception) =>
Microsoft.Extensions.Http.Diagnostics (13)
Logging\Internal\HttpClientLogger.cs (6)
116TimeSpan elapsed,
125TimeSpan elapsed,
132public void LogRequestStop(object? context, HttpRequestMessage request, HttpResponseMessage response, TimeSpan elapsed)
135public void LogRequestFailed(object? context, HttpRequestMessage request, HttpResponseMessage? response, Exception exception, TimeSpan elapsed)
158TimeSpan elapsed,
223LogRecord logRecord, LoggerMessageState loggerMessageState, in TimeSpan elapsed,
Microsoft.Extensions.Http.Diagnostics.Tests (49)
Logging\HttpClientLoggerTest.cs (11)
59BodyReadTimeout = TimeSpan.FromMinutes(5)
209BodyReadTimeout = TimeSpan.FromMinutes(5),
301BodyReadTimeout = TimeSpan.FromMinutes(5),
408BodyReadTimeout = TimeSpan.FromMinutes(5),
504BodyReadTimeout = TimeSpan.FromMinutes(5),
618BodyReadTimeout = TimeSpan.FromMinutes(5),
888BodyReadTimeout = TimeSpan.FromMinutes(5),
913fakeTimeProvider.Advance(TimeSpan.FromMilliseconds(1000));
984await logger.LogRequestStopAsync(new LogRecord(), httpRequestMessage, httpResponseMessage, TimeSpan.Zero);
1005Assert.Throws<NotSupportedException>(() => logger.LogRequestStop(null, httpRequestMessage, httpResponseMessage, TimeSpan.Zero));
1006Assert.Throws<NotSupportedException>(() => logger.LogRequestFailed(null, httpRequestMessage, null, new InvalidOperationException(), TimeSpan.Zero));
Microsoft.Extensions.Http.Polly (2)
Microsoft.Extensions.Http.Polly.Tests (7)
Microsoft.Extensions.Http.Resilience (22)
Microsoft.Extensions.Http.Resilience.PerformanceTests (5)
Microsoft.Extensions.Http.Resilience.Tests (58)
Microsoft.Extensions.Identity.Core (9)
Microsoft.Extensions.Logging.AzureAppServices (9)
Microsoft.Extensions.ML (11)
Builder\BuilderExtensions.cs (4)
69return builder.FromUri(modelName, uri, TimeSpan.FromMinutes(5));
84this PredictionEnginePoolBuilder<TData, TPrediction> builder, string uri, TimeSpan period)
107this PredictionEnginePoolBuilder<TData, TPrediction> builder, string modelName, string uri, TimeSpan period)
131this PredictionEnginePoolBuilder<TData, TPrediction> builder, string modelName, Uri uri, TimeSpan period)
Microsoft.Extensions.ML.Tests (2)
Microsoft.Extensions.ServiceDiscovery (8)
Microsoft.Extensions.ServiceDiscovery.Dns (44)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (12)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests.Fuzzing (1)
Microsoft.Extensions.Telemetry (9)
Microsoft.Extensions.Telemetry.Abstractions (1)
Microsoft.Extensions.Telemetry.Tests (2)
Microsoft.Extensions.TimeProvider.Testing (16)
FakeTimeProvider.cs (13)
21private DateTimeOffset _now = new(2000, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
24private TimeSpan _autoAdvanceAmount;
62/// This defaults to <see cref="TimeSpan.Zero"/>.
64/// <exception cref="ArgumentOutOfRangeException">The time value is less than <see cref="TimeSpan.Zero"/>.</exception>
65public TimeSpan AutoAdvanceAmount
126/// <exception cref="ArgumentOutOfRangeException">The time value is less than <see cref="TimeSpan.Zero"/>.</exception>
127public void Advance(TimeSpan delta)
153var delta = value - _now;
176Debug.Assert(TimestampFrequency == TimeSpan.TicksPerSecond, "Assuming frequency equals ticks per second");
195/// This is fixed to the value of <see cref="TimeSpan.TicksPerSecond"/>.
197public override long TimestampFrequency => TimeSpan.TicksPerSecond;
206public override ITimer CreateTimer(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period)
Microsoft.Extensions.TimeProvider.Testing.Tests (170)
FakeTimeProviderTests.cs (82)
30Assert.Equal(TimeSpan.Zero, now.Offset);
32Assert.Equal(TimeSpan.Zero, timeProvider.AutoAdvanceAmount);
46var nowOffset = new DateTimeOffset(2000, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
52Assert.Equal(nowOffset, new DateTimeOffset(timestamp1, TimeSpan.Zero));
53Assert.Equal(nowOffset, new DateTimeOffset(timestamp2, TimeSpan.Zero));
60var nowOffset = new DateTimeOffset(2000, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
63AutoAdvanceAmount = TimeSpan.FromMilliseconds(msToElapse)
69Assert.Equal(nowOffset, new DateTimeOffset(timestamp1, TimeSpan.Zero));
70Assert.Equal(nowOffset.AddMilliseconds(msToElapse), new DateTimeOffset(timestamp2, TimeSpan.Zero));
78timeProvider.Advance(TimeSpan.FromSeconds(1));
79var t = timeProvider.GetElapsedTime(st);
81Assert.Equal(TimeSpan.FromSeconds(1), t);
89AutoAdvanceAmount = TimeSpan.FromSeconds(1)
93var elapsedTime = timeProvider.GetElapsedTime(st);
94var elapsedTime2 = timeProvider.GetElapsedTime(st);
96Assert.Equal(TimeSpan.FromSeconds(1), elapsedTime);
97Assert.Equal(TimeSpan.FromSeconds(2), elapsedTime2);
103var timeProvider = new FakeTimeProvider(new DateTimeOffset(2001, 2, 3, 4, 5, 6, TimeSpan.Zero));
105timeProvider.Advance(TimeSpan.FromMilliseconds(8));
116Assert.Equal(TimeSpan.Zero, now.Offset);
119Assert.Equal(TimeSpan.Zero, timeProvider.AutoAdvanceAmount);
121timeProvider.Advance(TimeSpan.FromMilliseconds(8));
154var tz = TimeZoneInfo.CreateCustomTimeZone("DUMMY", TimeSpan.FromHours(2), null, null);
162var timeProvider = new FakeTimeProvider(new DateTimeOffset(2001, 2, 3, 4, 5, 6, TimeSpan.Zero));
172var utcDelta = finalTimeUtcNow - initialTimeUtcNow;
174var elapsedTime = timeProvider.GetElapsedTime(initialTimestamp, finalTimeTimestamp);
186var timeProvider = new FakeTimeProvider(new DateTimeOffset(2001, 2, 3, 4, 5, 6, TimeSpan.Zero));
191timeProvider.Advance(TimeSpan.FromMilliseconds(1234));
196var utcDelta = finalTimeUtcNow - initialTimeUtcNow;
198var elapsedTime = timeProvider.GetElapsedTime(initialTimestamp, finalTimeTimestamp);
212Assert.Throws<ArgumentOutOfRangeException>(() => timeProvider.Advance(TimeSpan.FromTicks(-1)));
220Assert.Throws<ArgumentOutOfRangeException>(() => timeProvider.SetUtcNow(timeProvider.GetUtcNow() - TimeSpan.FromTicks(1)));
232}, null, TimeSpan.FromSeconds(1), TimeSpan.Zero);
234tp.AdjustTime(tp.GetUtcNow() + TimeSpan.FromMilliseconds(999));
237tp.AdjustTime(tp.GetUtcNow() + TimeSpan.FromMilliseconds(1));
240tp.AdjustTime(tp.GetUtcNow() + TimeSpan.FromSeconds(10));
243tp.Advance(TimeSpan.FromMilliseconds(999));
246tp.Advance(TimeSpan.FromMilliseconds(1));
259}, null, TimeSpan.FromSeconds(1), TimeSpan.Zero);
261tp.AdjustTime(tp.GetUtcNow() - TimeSpan.FromMilliseconds(999));
264tp.AdjustTime(tp.GetUtcNow() - TimeSpan.FromMilliseconds(1));
267tp.AdjustTime(tp.GetUtcNow() - TimeSpan.FromSeconds(10));
270tp.Advance(TimeSpan.FromMilliseconds(999));
273tp.Advance(TimeSpan.FromMilliseconds(1));
280var dto = new DateTimeOffset(new DateTime(2022, 1, 2, 3, 4, 5, 6), TimeSpan.Zero);
286private readonly TimeSpan _infiniteTimeout = TimeSpan.FromMilliseconds(-1);
292var t = timeProvider.Delay(TimeSpan.Zero, CancellationToken.None);
303var delay = timeProvider.Delay(TimeSpan.FromMilliseconds(1), CancellationToken.None);
304timeProvider.Advance(TimeSpan.FromMilliseconds(1));
332using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMilliseconds(1000));
334var task = fakeTimeProvider.Delay(TimeSpan.FromMilliseconds(10000), cancellationTokenSource.Token);
336fakeTimeProvider.Advance(TimeSpan.FromMilliseconds(10000));
348using var cts = timeProvider.CreateCancellationTokenSource(TimeSpan.FromMilliseconds(1));
349timeProvider.Advance(TimeSpan.FromMilliseconds(1));
351await Assert.ThrowsAsync<TaskCanceledException>(() => timeProvider.Delay(TimeSpan.FromTicks(1), cts.Token));
362await Assert.ThrowsAsync<TimeoutException>(() => source.Task.WaitAsync(TimeSpan.FromTicks(-1), timeProvider, CancellationToken.None));
366await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => source.Task.WaitAsync(TimeSpan.FromMilliseconds(-2), timeProvider, CancellationToken.None));
375var t = source.Task.WaitAsync(TimeSpan.FromSeconds(100000), timeProvider, CancellationToken.None);
378timeProvider.Advance(TimeSpan.FromMilliseconds(1));
395var t = source.Task.WaitAsync(TimeSpan.FromMilliseconds(-1), timeProvider, CancellationToken.None);
398timeProvider.Advance(TimeSpan.FromMilliseconds(1));
414var t = source.Task.WaitAsync(TimeSpan.FromMilliseconds(1), timeProvider, CancellationToken.None);
417timeProvider.Advance(TimeSpan.FromMilliseconds(1));
446AutoAdvanceAmount = TimeSpan.FromSeconds(1)
454Assert.Equal(timeProvider.Start + TimeSpan.FromSeconds(1), second);
455Assert.Equal(timeProvider.Start + TimeSpan.FromSeconds(2), third);
473AutoAdvanceAmount = TimeSpan.FromSeconds(1)
478timeProvider.AutoAdvanceAmount = TimeSpan.Zero;
485var oneSecond = TimeSpan.FromSeconds(1);
494}, null, TimeSpan.Zero, oneSecond);
503var provider = new FakeTimeProvider { AutoAdvanceAmount = TimeSpan.FromSeconds(2) };
505using var timer = provider.CreateTimer(calls.Add, "timer-1", TimeSpan.FromSeconds(3), TimeSpan.Zero);
515th.Join(TimeSpan.FromMilliseconds(200));
544await provider.Delay(TimeSpan.FromSeconds(taskDelay));
558await provider.Delay(TimeSpan.FromSeconds(delay)).ConfigureAwait(false);
569provider.Advance(TimeSpan.FromSeconds(taskDelay));
572provider.Advance(TimeSpan.FromSeconds(delay));
TimerTests.cs (88)
25using var timer = timeProvider.CreateTimer(_ => { counter++; }, null, TimeSpan.FromMilliseconds(10), TimeSpan.Zero);
29timeProvider.Advance(TimeSpan.FromMilliseconds(20));
33timeProvider.Advance(TimeSpan.FromMilliseconds(1000));
47using var timer = timeProvider.CreateTimer(_ => { counter++; }, null, TimeSpan.FromMilliseconds(10), Timeout.InfiniteTimeSpan);
51timeProvider.Advance(TimeSpan.FromMilliseconds(20));
55timeProvider.Advance(TimeSpan.FromMilliseconds(1000));
69using var timer = timeProvider.CreateTimer(_ => { counter++; }, null, TimeSpan.Zero, Timeout.InfiniteTimeSpan);
73timeProvider.Advance(TimeSpan.FromMilliseconds(100));
77timeProvider.Advance(TimeSpan.FromMilliseconds(100));
91var timer = timeProvider.CreateTimer(_ => { counter++; }, null, Timeout.InfiniteTimeSpan, TimeSpan.FromMilliseconds(10));
95timeProvider.Advance(TimeSpan.FromMilliseconds(1));
99timeProvider.Advance(TimeSpan.FromMilliseconds(50));
113var timer = timeProvider.CreateTimer(_ => { counter++; }, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(10));
117timeProvider.Advance(TimeSpan.FromMilliseconds(1));
121timeProvider.Advance(TimeSpan.FromMilliseconds(10));
125timeProvider.Advance(TimeSpan.FromMilliseconds(10));
139_ = t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
141Assert.Throws<ArgumentOutOfRangeException>("dueTime", () => t.Change(TimeSpan.FromMilliseconds(-2), TimeSpan.FromMilliseconds(1)));
142Assert.Throws<ArgumentOutOfRangeException>("dueTime", () => t.Change(TimeSpan.FromMilliseconds(-2), TimeSpan.FromSeconds(1)));
143Assert.Throws<ArgumentOutOfRangeException>("dueTime", () => t.Change(TimeSpan.FromMilliseconds(0xFFFFFFFFL), TimeSpan.FromMilliseconds(1)));
144Assert.Throws<ArgumentOutOfRangeException>("dueTime", () => t.Change(TimeSpan.FromMilliseconds(0xFFFFFFFFL), TimeSpan.FromSeconds(1)));
151_ = t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
153Assert.Throws<ArgumentOutOfRangeException>("period", () => t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(-2)));
154Assert.Throws<ArgumentOutOfRangeException>("period", () => t.Change(TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(-2)));
155Assert.Throws<ArgumentOutOfRangeException>("period", () => t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(0xFFFFFFFFL)));
156Assert.Throws<ArgumentOutOfRangeException>("period", () => t.Change(TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(0xFFFFFFFFL)));
163_ = t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
165Assert.True(t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1)));
167Assert.False(t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1)));
174_ = t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
176Assert.True(t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1)));
178Assert.False(t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1)));
190var timer1 = timeProvider.CreateTimer(_ => timer1Counter++, null, TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
191var timer2 = timeProvider.CreateTimer(_ => timer2Counter++, null, TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
195timeProvider.Advance(TimeSpan.FromMilliseconds(1));
201timeProvider.Advance(TimeSpan.FromMilliseconds(1));
253using var timer = timeProvider.CreateTimer(_ => { callbackTime = timeProvider.GetUtcNow(); }, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(10));
257timeProvider.SetUtcNow(timeProvider.Start + TimeSpan.FromMilliseconds(20));
261timeProvider.SetUtcNow(timeProvider.Start + TimeSpan.FromMilliseconds(1000));
266Assert.Equal(timeProvider.Start + TimeSpan.FromMilliseconds(20), value2);
267Assert.Equal(timeProvider.Start + TimeSpan.FromMilliseconds(1000), value3);
275var period = TimeSpan.FromMilliseconds(10);
276var timer = timeProvider.CreateTimer(_ => { callbackTimes.Add(timeProvider.GetUtcNow()); }, null, TimeSpan.Zero, period);
298var callbacks = new List<(int timerId, TimeSpan callbackTime)>();
301using var timer1 = timeProvider.CreateTimer(_ => callbacks.Add((1, timeProvider.GetElapsedTime(startTime))), null, TimeSpan.FromMilliseconds(3), TimeSpan.FromMilliseconds(3));
302using var timer2 = timeProvider.CreateTimer(_ => callbacks.Add((2, timeProvider.GetElapsedTime(startTime))), null, TimeSpan.FromMilliseconds(3), TimeSpan.FromMilliseconds(3));
303using var timer3 = timeProvider.CreateTimer(_ => callbacks.Add((3, timeProvider.GetElapsedTime(startTime))), null, TimeSpan.FromMilliseconds(6), TimeSpan.FromMilliseconds(5));
305timeProvider.Advance(TimeSpan.FromMilliseconds(3));
306timeProvider.Advance(TimeSpan.FromMilliseconds(3));
307timeProvider.Advance(TimeSpan.FromMilliseconds(3));
308timeProvider.Advance(TimeSpan.FromMilliseconds(2));
312(1, TimeSpan.FromMilliseconds(3)),
313(2, TimeSpan.FromMilliseconds(3)),
314(3, TimeSpan.FromMilliseconds(6)),
315(1, TimeSpan.FromMilliseconds(6)),
316(2, TimeSpan.FromMilliseconds(6)),
317(1, TimeSpan.FromMilliseconds(9)),
318(2, TimeSpan.FromMilliseconds(9)),
319(3, TimeSpan.FromMilliseconds(11)),
339timers.Add(timeProvider.CreateTimer(index => triggers[(int)index!] = true, i, TimeSpan.FromSeconds(dueTimes[i]), TimeSpan.Zero));
340timeProvider.Advance(TimeSpan.FromTicks(1));
357timeProvider.Advance(TimeSpan.FromSeconds(2));
Microsoft.Extensions.Validation (1)
Microsoft.Extensions.Validation.GeneratorTests (8)
Microsoft.Extensions.Validation.Tests (1)
Microsoft.Gen.Logging.Generated.Tests (1)
Microsoft.JSInterop (7)
Microsoft.JSInterop.Tests (5)
Microsoft.Maui (10)
Microsoft.Maui.Controls (23)
Microsoft.Maui.Controls.Build.Tasks (5)
Microsoft.Maui.Controls.Xaml (3)
Microsoft.Maui.Essentials (19)
Microsoft.Maui.Resizetizer (1)
Microsoft.ML.AutoML (5)
Microsoft.ML.AutoML.Interactive (3)
Microsoft.ML.AutoML.Tests (3)
Microsoft.ML.Core (5)
Microsoft.ML.Core.Tests (2)
Microsoft.ML.Data (35)
Data\Conversion.cs (19)
27using TS = TimeSpan;
236AddStd<TX, TS>(Convert);
250AddStd<TS, I8>(Convert);
251AddStd<TS, R4>(Convert);
252AddStd<TS, R8>(Convert);
253AddAux<TS, SB>(Convert);
254AddStd<TS, TX>(Convert);
291AddIsDef<TS>(IsDefault);
313AddTryParse<TS>(TryParse);
789private bool IsDefault(in TS src) => src.Equals(default(TS));
833public void Convert(in TS src, ref I8 dst) => dst = (I8)src.Ticks;
891public void Convert(in TS src, ref R4 dst) => dst = (R4)src.Ticks;
909public void Convert(in TS src, ref R8 dst) => dst = (R8)src.Ticks;
934public void Convert(in TS src, ref SB dst) { ClearDst(ref dst); dst.AppendFormat("{0:c}", src); }
952public void Convert(in TS src, ref TX dst) => dst = string.Format("{0:c}", src).AsMemory();
1401public bool TryParse(in TX src, out TS dst)
1409if (TimeSpan.TryParse(src.ToString(), CultureInfo.InvariantCulture, out dst))
1715public void Convert(in TX span, ref TS value) => TryParse(in span, out value);
Microsoft.ML.DataView (2)
Microsoft.ML.IntegrationTests (2)
Microsoft.ML.Maml (2)
Microsoft.ML.Parquet (4)
Microsoft.ML.PerformanceTests (1)
Microsoft.ML.Samples (1)
Microsoft.ML.TestFramework (4)
Microsoft.ML.TestFrameworkCommon (3)
Microsoft.ML.Tests (1)
Microsoft.ML.Tokenizers (6)
Microsoft.ML.Tokenizers.Data.Tests (1)
Microsoft.ML.Tokenizers.Tests (3)
Microsoft.Net.Http.Headers (16)
Microsoft.Net.Http.Headers.Tests (37)
Microsoft.VisualBasic.Core (5)
Microsoft.VisualStudio.LanguageServices (14)
Microsoft.VisualStudio.LanguageServices.CodeLens (1)
Microsoft.VisualStudio.LanguageServices.CSharp (3)
Mongo.AppHost (1)
MSBuild (2)
MSBuildTaskHost (10)
mscorlib (1)
Mvc.RoutingWebSite (1)
MvcFormSample (1)
Nats.ApiService (1)
netstandard (1)
OpenIdConnectSample (1)
OutputCachingSample (2)
PortableTask (1)
PresentationBuildTasks (3)
PresentationCore (811)
System\Windows\Media\Animation\Clock.cs (146)
120_nextTickNeededTime = TimeSpan.Zero;
263public TimeSpan? CurrentTime
484protected virtual TimeSpan GetCurrentTimeCore()
488return _currentTime ?? TimeSpan.Zero;
519protected TimeSpan CurrentGlobalTime
525return TimeSpan.Zero;
606if (!_resolvedDuration.HasTimeSpan || _resolvedDuration.TimeSpan > TimeSpan.Zero)
682TimeSpan beginTime, TimeSpan? endTime,
691TimeSpan beginTime, TimeSpan endTime, Duration period,
704TimeSpan? lastCurrentTime = _currentTime;
757InternalSeek(TimeSpan.Zero);
852internal void InternalSeek(TimeSpan destination)
875internal void InternalSeekAlignedToLastTick(TimeSpan destination)
961TimeSpan? effectiveDuration;
1232TimeSpan? expirationTime;
1351internal TimeSpan? InternalNextTickNeededTime
1862TimeSpan previewParentTime = CurrentGlobalTime;
1919TimeSpan nextDesiredTick = InternalNextTickNeededTime == TimeSpan.Zero ? _rootData.CurrentAdjustedGlobalTime
1932private bool ComputeCurrentIteration(TimeSpan parentTime, double parentSpeed,
1933TimeSpan? expirationTime,
1934out TimeSpan localProgress)
1948TimeSpan beginTimeForOffsetComputation = _currentIterationBeginTime ?? _beginTime.Value;
1949TimeSpan offsetFromBegin = MultiplyTimeSpan(parentTime - beginTimeForOffsetComputation, _appliedSpeedRatio);
1956if (_currentDuration.TimeSpan == TimeSpan.Zero) // We must be post-filling if we have gotten here
1961localProgress = TimeSpan.Zero;
1964_currentTime = TimeSpan.Zero;
2063TimeSpan optimizedOffsetFromBegin;
2086localProgress = TimeSpan.FromTicks(offsetFromBegin.Ticks % _currentDuration.TimeSpan.Ticks);
2091if ((localProgress == TimeSpan.Zero)
2115if (localProgress == TimeSpan.Zero)
2122InternalNextTickNeededTime = TimeSpan.Zero;
2138TimeSpan timeUntilNextBoundary;
2140if (localProgress == TimeSpan.Zero) // We are currently exactly at a boundary
2146TimeSpan decelBegin = MultiplyTimeSpan(_currentDuration.TimeSpan, 1.0 - _timeline.DecelerationRatio);
2151TimeSpan accelEnd = MultiplyTimeSpan(_currentDuration.TimeSpan, _timeline.AccelerationRatio);
2155TimeSpan proposedNextTickTime = CurrentGlobalTime + timeUntilNextBoundary;
2182private void ComputeCurrentIterationWithGrow(TimeSpan parentTime, TimeSpan? expirationTime,
2183out TimeSpan localProgress, out int newIteration)
2191TimeSpan offsetFromBegin = MultiplyTimeSpan(parentTime - _currentIterationBeginTime.Value, _appliedSpeedRatio);
2204localProgress = TimeSpan.FromTicks(offsetOnLaterIterations % _resolvedDuration.TimeSpan.Ticks);
2248private bool ComputeCurrentState(TimeSpan? expirationTime, ref TimeSpan parentTime, double parentSpeed, bool isInTick)
2292InternalNextTickNeededTime = TimeSpan.Zero; // We need ticks immediately
2330private bool ComputeCurrentTime(TimeSpan localProgress, out double localSpeed)
2340Debug.Assert(_currentDuration.TimeSpan > TimeSpan.Zero, "ComputeCurrentTime was entered with _currentDuration <= 0");
2376InternalNextTickNeededTime = TimeSpan.Zero;
2400InternalNextTickNeededTime = TimeSpan.Zero;
2404_currentTime = TimeSpan.FromTicks((long)((t * durationInTicks) + 0.5));
2465private TimeSpan? ComputeEffectiveDuration()
2475TimeSpan? effectiveDuration;
2478if (_currentDuration.HasTimeSpan && _currentDuration.TimeSpan == TimeSpan.Zero)
2481effectiveDuration = TimeSpan.Zero;
2487effectiveDuration = TimeSpan.Zero;
2511TimeSpan previousIterationDuration = TimeSpan.Zero;
2538effectiveDuration = TimeSpan.FromTicks((long)(presentAndFutureDuration / _appliedSpeedRatio + 0.5)) + previousIterationDuration;
2557private void ComputeEvents(TimeSpan? expirationTime,
2579postFillDuration = TimeSpan.Zero; // There is no reachable postfill zone because the active period is infinite
2615else if (postFillDuration != TimeSpan.Zero && // Our active period is finite and we have fill behavior
2639private bool ComputeExpirationTime(out TimeSpan? expirationTime)
2644TimeSpan? effectiveDuration;
2665expirationTime += TimeSpan.FromMilliseconds(50); // This compensation is roughly one frame of video
2796TimeSpan? endOfActivePeriod)
2804TimeSpan relativeBeginTime = _currentIterationBeginTime ?? _beginTime.Value;
2827TimeSpan? endOfActivePeriod,
2831TimeSpan relativeBeginTime = _currentIterationBeginTime ?? _beginTime.Value;
2875TimeSpan? parentTime; // Computed parent-local time
2876TimeSpan? expirationTime; // Computed expiration time with respect to repeat behavior and resolved duration;
2877TimeSpan localProgress; // Computed time inside simple duration
2879TimeSpan parentTimeValue;
2989private bool ComputeNextTickNeededTime(TimeSpan? expirationTime,
2990TimeSpan parentTime, double parentSpeed)
3000InternalNextTickNeededTime = IsInteractivelyPaused ? TimeSpan.Zero : (TimeSpan?)null;
3005TimeSpan? timeUntilNextBoundary = null;
3017TimeSpan timeUntilBegin = MultiplyTimeSpan(_beginTime.Value - parentTime, invertedParentSpeed);
3026if (timeUntilBegin >= TimeSpan.Zero)
3033TimeSpan timeUntilExpiration = MultiplyTimeSpan(expirationTime.Value - parentTime, invertedParentSpeed);
3035if (timeUntilExpiration >= TimeSpan.Zero &&
3063private bool ComputeParentParameters(out TimeSpan? parentTime, out double? parentSpeed,
3081InternalNextTickNeededTime = TimeSpan.Zero; // When TimeManager wakes up, we will need an update
3148TimeSpan currentParentTimePT)
3173TimeSpan relativeBeginTimePT = _currentIterationBeginTime ?? _beginTime.Value;
3174TimeSpan previewCurrentOffsetPT = currentParentTimePT - relativeBeginTimePT; // This is our time offset (not yet scaled by speed)
3175TimeSpan previewCurrentTimeLT = MultiplyTimeSpan(previewCurrentOffsetPT, _appliedSpeedRatio); // This is what our time would be
3185TimeSpan? expirationTimePT;
3191TimeSpan ourSyncTimeST = (_syncData.SyncClock == this) ?
3196TimeSpan? syncClockEffectiveDurationST = _syncData.SyncClockEffectiveDuration;
3205_syncData.PreviousSyncClockTime = TimeSpan.FromTicks(ourSyncTimeST.Ticks % syncClockDuration.TimeSpan.Ticks);
3211_syncData.PreviousRepeatTime = TimeSpan.Zero;
3228TimeSpan? previousSyncParentTimeSPT = (_syncData.SyncClock == this) ?
3241TimeSpan timeIntoSyncPeriodPT = previewCurrentOffsetPT;
3263_syncData.PreviousSyncClockTime = TimeSpan.Zero;
3264_syncData.PreviousRepeatTime = TimeSpan.Zero;
3281TimeSpan currentParentTimePT, double currentParentSpeed)
3301TimeSpan previousParentTimePT = parentIntervalCollection.IsEmptyOfRealPoints ? currentParentTimePT
3303TimeSpan parentElapsedTimePT = currentParentTimePT - previousParentTimePT;
3306TimeSpan ourProjectedElapsedTimeLT = MultiplyTimeSpan(parentElapsedTimePT, _appliedSpeedRatio);
3308TimeSpan syncTimeST = _syncData.SyncClock.GetCurrentTimeCore();
3309TimeSpan syncElapsedTimeST = syncTimeST - _syncData.PreviousSyncClockTime; // Elapsed from last tick
3311if (syncElapsedTimeST > TimeSpan.Zero) // Only store the last value if it is greater than
3315TimeSpan? effectiveDurationST = _syncData.SyncClockEffectiveDuration;
3322_syncData.PreviousRepeatTime = TimeSpan.Zero;
3334_syncData.PreviousSyncClockTime = TimeSpan.Zero;
3344syncElapsedTimeST = TimeSpan.Zero;
3348TimeSpan syncElapsedTimeLT = (_syncData.SyncClock == this)
3353TimeSpan parentTimeSlipPT = parentElapsedTimePT - DivideTimeSpan(syncElapsedTimeLT, _appliedSpeedRatio);
3501private TimeSpan GetCurrentDesiredFrameTime(TimeSpan time)
3507private TimeSpan GetDesiredFrameTime(TimeSpan time, int frameOffset)
3516return TimeSpan.FromTicks(desiredFrameTick);
3520private TimeSpan GetNextDesiredFrameTime(TimeSpan time)
3651private TimeSpan DivideTimeSpan(TimeSpan timeSpan, double factor)
3654return TimeSpan.FromTicks((long)(((double)timeSpan.Ticks) / factor + 0.5));
3670private static TimeSpan MultiplyTimeSpan(TimeSpan timeSpan, double factor)
3672return TimeSpan.FromTicks((long)(factor * (double)timeSpan.Ticks + 0.5));
3682subtree.Current.InternalNextTickNeededTime = TimeSpan.Zero;
3686while (current != null && current.InternalNextTickNeededTime != TimeSpan.Zero)
3688current.InternalNextTickNeededTime = TimeSpan.Zero;
4023internal TimeSpan? SyncClockEffectiveDuration
4045internal TimeSpan PreviousSyncClockTime
4051internal TimeSpan PreviousRepeatTime
4057internal TimeSpan SyncClockBeginTime
4072private TimeSpan? _syncClockEffectiveDuration; // This reflects RepeatBehavior (local coordinates)
4074private TimeSpan? _syncClockBeginTime;
4075private TimeSpan _previousSyncClockTime;
4076private TimeSpan _previousRepeatTime; // How many complete iterations we already have done
4088internal TimeSpan CurrentAdjustedGlobalTime
4106internal TimeSpan LastAdjustedGlobalTime
4115internal TimeSpan? PendingSeekDestination
4130private TimeSpan _currentAdjustedGlobalTime;
4131private TimeSpan _lastAdjustedGlobalTime;
4132private TimeSpan? _pendingSeekDestination;
4398private TimeSpan? _currentTime; // Precalculated current global time
4413internal TimeSpan? _beginTime;
4419private TimeSpan? _currentIterationBeginTime;
4422internal TimeSpan? _nextTickNeededTime = null;
4470private static Int64 s_TimeSpanTicksPerSecond = TimeSpan.FromSeconds(1).Ticks;
System\Windows\Media\Animation\TimeIntervalCollection.cs (85)
121private TimeIntervalCollection(TimeSpan point)
130private void InitializePoint(TimeSpan point)
147private TimeIntervalCollection(TimeSpan point, bool includePoint)
172private TimeIntervalCollection(TimeSpan from, bool includeFrom, TimeSpan to, bool includeTo)
246internal TimeSpan FirstNodeTime
264internal TimeIntervalCollection SlipBeginningOfConnectedInterval(TimeSpan slipTime)
266if (slipTime == TimeSpan.Zero) // The no-op case
293internal TimeIntervalCollection SetBeginningOfConnectedInterval(TimeSpan beginTime)
316internal static TimeIntervalCollection CreatePoint(TimeSpan time)
324internal static TimeIntervalCollection CreateClosedOpenInterval(TimeSpan from, TimeSpan to)
332internal static TimeIntervalCollection CreateOpenClosedInterval(TimeSpan from, TimeSpan to)
340internal static TimeIntervalCollection CreateInfiniteClosedInterval(TimeSpan from)
397internal bool Contains(TimeSpan time)
527internal bool Intersects(TimeSpan from, TimeSpan to)
535TimeSpan temp = from;
852internal bool IntersectsPeriodicCollection(TimeSpan beginTime, Duration period, double appliedSpeedRatio,
859|| (period == TimeSpan.Zero) // The PTIC has no nonzero period, we define such intersections nonexistent
981internal bool IntersectsMultiplePeriods(TimeSpan beginTime, Duration period, double appliedSpeedRatio)
986|| (period == TimeSpan.Zero) // The PTIC has no nonzero period, we define such intersections nonexistent
1004TimeSpan lastNodeTime = _nodeTime[_count - 1];
1027TimeSpan beginTime, TimeSpan endTime, Duration period,
1036Debug.Assert(!period.HasTimeSpan || period.TimeSpan > TimeSpan.Zero || beginTime == endTime); // Check the consistency of degenerate case where simple duration is zero; expiration time should equal beginTime
1101projection.InitializePoint(TimeSpan.FromTicks(outputInTicks));
1149TimeSpan beginTime, Nullable<TimeSpan> endTime,
1161Debug.Assert(endTime.HasValue || fillDuration == TimeSpan.Zero); // Either endTime is finite, or it's infinite hence we cannot have any fill zone
1162Debug.Assert(!period.HasTimeSpan || period.TimeSpan > TimeSpan.Zero || (endTime.HasValue && beginTime == endTime)); // Check the consistency of degenerate case where simple duration is zero; expiration time should equal beginTime
1175&& _nodeIsPoint[_count - 1] && (endTime > beginTime || fillDuration.TimeSpan > TimeSpan.Zero)))); // ...we may have a point intersection with the stopped zone
1181projection.InitializePoint(TimeSpan.Zero);
1185bool includeFillPeriod = !fillDuration.HasTimeSpan || fillDuration.TimeSpan > TimeSpan.Zero; // This variable represents whether we have a non-zero fill zone
1194Nullable<TimeSpan> activeDuration;
1235TimeSpan beginTime, Nullable<TimeSpan> endTime, bool includeFillPeriod, double speedRatio)
1256projection.CurrentNodeTime = TimeSpan.Zero;
1269projection.CurrentNodeTime = TimeSpan.FromTicks((long)(speedRatio * timeOffset));
1287projection.CurrentNodeTime = TimeSpan.FromTicks((long)(speedRatio * timeOffset));
1304private void ProjectionFold(ref TimeIntervalCollection projection, Nullable<TimeSpan> activeDuration,
1312Debug.Assert(CurrentNodeTime >= TimeSpan.Zero); // Verify that we are already clipped
1346private void ProjectionFoldPoint(ref TimeIntervalCollection projection, Nullable<TimeSpan> activeDuration,
1375projection.MergePoint(TimeSpan.FromTicks(currentProjection));
1389private bool ProjectionFoldInterval(ref TimeIntervalCollection projection, Nullable<TimeSpan> activeDuration,
1440projection.MergeInterval(TimeSpan.Zero, true,
1441TimeSpan.FromTicks(currentProjection), includeTime);
1446projection.MergeInterval(TimeSpan.FromTicks(currentProjection), includeTime,
1447TimeSpan.FromTicks(periodInTicks), true);
1457projection.MergeInterval(TimeSpan.Zero, true,
1458TimeSpan.FromTicks(clippedTime), NextNodeIsPoint);
1465projection.MergeInterval(TimeSpan.FromTicks(clippedTime), NextNodeIsPoint,
1466TimeSpan.FromTicks(periodInTicks), true);
1477projection.MergeInterval(TimeSpan.FromTicks(currentProjection - intervalLength), NextNodeIsPoint,
1478TimeSpan.FromTicks(currentProjection), CurrentNodeIsPoint);
1482projection.MergeInterval(TimeSpan.FromTicks(currentProjection), CurrentNodeIsPoint,
1483TimeSpan.FromTicks(currentProjection + intervalLength), NextNodeIsPoint);
1499projection._nodeTime[0] = TimeSpan.Zero;
1503projection._nodeTime[1] = TimeSpan.FromTicks(periodInTicks);
1513projection.MergeInterval(TimeSpan.FromTicks(currentProjection), CurrentNodeIsPoint,
1514TimeSpan.FromTicks(periodInTicks), false);
1517projection.MergeInterval(TimeSpan.Zero, true,
1518TimeSpan.FromTicks(intervalLength - timeBeforeNextPeriod), NextNodeIsPoint);
1524projection.MergePoint(TimeSpan.FromTicks(periodInTicks));
1528projection.MergePoint(TimeSpan.Zero);
1536projection.MergeInterval(TimeSpan.FromTicks(currentProjection), CurrentNodeIsPoint,
1537TimeSpan.FromTicks(currentProjection + intervalLength), NextNodeIsPoint);
1550private void MergePoint(TimeSpan point)
1605private void MergeInterval(TimeSpan from, bool includeFrom,
1606TimeSpan to, bool includeTo)
1776_nodeTime = new TimeSpan[requiredCapacity];
1787TimeSpan[] newNodeTime = new TimeSpan[newCapacity];
1821TimeSpan accelEnd = TimeSpan.FromTicks((long)(dpPeriod * accelRatio));
1822TimeSpan decelStart = TimeSpan.FromTicks(periodInTicks - (long)(dpPeriod * decelRatio));
1832_nodeTime[_current] = TimeSpan.FromTicks((long)(halfMaxRate * inversePeriod * t * t / accelRatio));
1840_nodeTime[_current] = TimeSpan.FromTicks((long)(halfMaxRate * (2 * t - (accelRatio * dpPeriod))));
1848_nodeTime[_current] = TimeSpan.FromTicks(periodInTicks - (long)(halfMaxRate * inversePeriod * t * t / decelRatio));
2121private int Locate(TimeSpan time)
2196private TimeSpan CurrentNodeTime
2238private TimeSpan NextNodeTime
2283private TimeSpan[] _nodeTime; // An interval's begin time
PresentationCore.Tests (36)
System\Windows\DurationConverter.Tests.cs (8)
16[InlineData(false, typeof(TimeSpan))]
31[InlineData(false, typeof(TimeSpan))]
48Assert.Equal(expected, TimeSpan.Parse(expected).ToString());
78[InlineData(typeof(TimeSpan))]
106yield return new object?[] { new Duration(TimeSpan.FromTicks(6488853448000)), CultureInfo.InvariantCulture, "07:12:14:45.3448 " };
107yield return new object?[] { new Duration(TimeSpan.FromTicks(5624853448000)), new CultureInfo("ru-RU"), " 6:12:14:45,3448 " };
109yield return new object?[] { new Duration(TimeSpan.FromTicks(5184000000000)), CultureInfo.InvariantCulture, " 6 " };
111yield return new object?[] { new Duration(TimeSpan.FromTicks(223200000000)), CultureInfo.InvariantCulture, " 6:12 " };
System\Windows\Media\Animation\RepeatBehavior.Tests.cs (25)
53public void Constructor_NegativeDuration_ThrowsArgumentOutOfRangeException(TimeSpan duration)
62yield return new object[] { TimeSpan.MinValue };
63yield return new object[] { TimeSpan.FromTicks(-1) };
69public void Kind_Duration_ReturnsExpected_Value(TimeSpan duration)
80yield return new object[] { TimeSpan.Zero };
81yield return new object[] { TimeSpan.MaxValue };
82yield return new object[] { TimeSpan.FromSeconds(1) };
89RepeatBehavior behavior = new RepeatBehavior(TimeSpan.FromSeconds(1));
98RepeatBehavior behavior = new RepeatBehavior(TimeSpan.FromSeconds(1));
161yield return new object[] { new RepeatBehavior(TimeSpan.FromSeconds(1)), new RepeatBehavior(TimeSpan.FromSeconds(1)), true };
162yield return new object[] { new RepeatBehavior(TimeSpan.FromDays(3)), new RepeatBehavior(TimeSpan.FromDays(3)), true };
163yield return new object[] { new RepeatBehavior(TimeSpan.FromSeconds(1111)), new RepeatBehavior(TimeSpan.FromSeconds(1111)), true };
166yield return new object[] { new RepeatBehavior(TimeSpan.FromSeconds(1111)), new RepeatBehavior(TimeSpan.FromSeconds(1112)), false };
167yield return new object[] { new RepeatBehavior(TimeSpan.FromSeconds(0)), new RepeatBehavior(TimeSpan.FromSeconds(8888)), false };
168yield return new object[] { new RepeatBehavior(TimeSpan.FromDays(5)), new RepeatBehavior(TimeSpan.FromDays(7)), false };
171yield return new object[] { new RepeatBehavior(1), new RepeatBehavior(TimeSpan.FromSeconds(1)), false };
172yield return new object[] { new RepeatBehavior(1111), new RepeatBehavior(TimeSpan.FromSeconds(1112)), false };
178yield return new object[] { RepeatBehavior.Forever, new RepeatBehavior(TimeSpan.FromSeconds(1112)), false };
182yield return new object[] { RepeatBehavior.Forever, new RepeatBehavior(TimeSpan.Zero), false };
PresentationFramework (78)
System\Windows\Media\Animation\Storyboard.cs (16)
1472public Nullable<TimeSpan> GetCurrentTime( FrameworkElement containingObject )
1482public Nullable<TimeSpan> GetCurrentTime( FrameworkContentElement containingObject )
1491public TimeSpan GetCurrentTime()
1493Nullable<TimeSpan> currentTime = GetCurrentTimeImpl(this);
1501return default(TimeSpan);
1505private Nullable<TimeSpan> GetCurrentTimeImpl( DependencyObject containingObject )
1694public void Seek( FrameworkElement containingObject, TimeSpan offset, TimeSeekOrigin origin )
1704public void Seek( FrameworkContentElement containingObject, TimeSpan offset, TimeSeekOrigin origin )
1714public void Seek( TimeSpan offset, TimeSeekOrigin origin )
1724public void Seek( TimeSpan offset )
1729private void SeekImpl( DependencyObject containingObject, TimeSpan offset, TimeSeekOrigin origin )
1742public void SeekAlignedToLastTick( FrameworkElement containingObject, TimeSpan offset, TimeSeekOrigin origin )
1752public void SeekAlignedToLastTick( FrameworkContentElement containingObject, TimeSpan offset, TimeSeekOrigin origin )
1762public void SeekAlignedToLastTick( TimeSpan offset, TimeSeekOrigin origin )
1772public void SeekAlignedToLastTick( TimeSpan offset )
1777private void SeekAlignedToLastTickImpl( DependencyObject containingObject, TimeSpan offset, TimeSeekOrigin origin )
PresentationFramework.Aero (31)
PresentationFramework.Aero2 (31)
PresentationFramework.AeroLite (1)
PresentationFramework.Classic (1)
PresentationFramework.Luna (1)
PresentationFramework.Royale (1)
PresentationFramework.Tests (4)
Producer (2)
RateLimitingSample (2)
RazorWebSite (2)
ReachFramework (1)
ResponseCachingSample (1)
ResponseCompressionSample (1)
Roslyn.Diagnostics.Analyzers (10)
Roslyn.VisualStudio.DiagnosticsWindow (3)
Roslyn.VisualStudio.Next.UnitTests (5)
RoutingSandbox (3)
RoutingWebSite (2)
RunTests (30)
SampleStartups (1)
ScenarioTests.Common.Tests (15)
Security.TransportSecurity.IntegrationTests (3)
ServiceBusWorker (1)
SessionSample (1)
Shared (23)
Shared.Tests (37)
SignalRSamples (3)
SocialSample (2)
Sockets.BindTests (6)
Sockets.FunctionalTests (32)
StartRequestDelegateUrlApp (1)
StartRouteBuilderUrlApp (1)
StartWithIApplicationBuilderUrlApp (1)
Stress.ApiService (2)
Stress.AppHost (1)
Stress.TelemetryService (2)
System.Collections.Concurrent (13)
System\Collections\Concurrent\BlockingCollection.cs (13)
311/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds
312/// to wait, or a <see cref="System.TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
325public bool TryAdd(T item, TimeSpan timeout)
564/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds
565/// to wait, or a <see cref="System.TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
577public bool TryTake([MaybeNullWhen(false)] out T item, TimeSpan timeout)
844/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds
845/// to wait, or a <see cref="System.TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
862public static int TryAddToAny(BlockingCollection<T>[] collections, T item, TimeSpan timeout)
1204/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds
1205/// to wait, or a <see cref="System.TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
1224public static int TryTakeFromAny(BlockingCollection<T>[] collections, out T? item, TimeSpan timeout)
1696private static void ValidateTimeout(TimeSpan timeout)
System.Collections.Immutable (1)
System.ComponentModel.Annotations (3)
System.ComponentModel.TypeConverter (11)
System.Configuration.ConfigurationManager (46)
System.Data.Common (70)
System.Data.Odbc (13)
System.Data.OleDb (1)
System.Diagnostics.DiagnosticSource (13)
System.Diagnostics.EventLog (1)
System.Diagnostics.Process (13)
System.DirectoryServices (4)
System.DirectoryServices.Protocols (8)
System.Formats.Asn1 (11)
System.Formats.Cbor (2)
System.Formats.Nrbf (13)
System.Formats.Tar (5)
System.IO.FileSystem.Watcher (2)
System.IO.IsolatedStorage (3)
System\IO\IsolatedStorage\IsolatedStorageFile.cs (3)
247return new DateTimeOffset(1601, 1, 1, 0, 0, 0, TimeSpan.Zero).ToLocalTime();
263return new DateTimeOffset(1601, 1, 1, 0, 0, 0, TimeSpan.Zero).ToLocalTime();
279return new DateTimeOffset(1601, 1, 1, 0, 0, 0, TimeSpan.Zero).ToLocalTime();
System.IO.Pipes (3)
System.Linq.Expressions (2)
System.Management (20)
artifacts\obj\System.Management\Debug\net10.0\System.Management.notsupported.cs (20)
69public ConnectionOptions(string locale, string username, System.Security.SecureString password, string authority, System.Management.ImpersonationLevel impersonation, System.Management.AuthenticationLevel authentication, bool enablePrivileges, System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
70public ConnectionOptions(string locale, string username, string password, string authority, System.Management.ImpersonationLevel impersonation, System.Management.AuthenticationLevel authentication, bool enablePrivileges, System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
84public DeleteOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
90public EnumerationOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout, int blockSize, bool rewindable, bool returnImmediatley, bool useAmendedQualifiers, bool ensureLocatable, bool prototypeOnly, bool directRead, bool enumerateDeep) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
117public EventWatcherOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout, int blockSize) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
132public InvokeMethodOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
214public static string ToDmtfTimeInterval(System.TimeSpan timespan) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
215public static System.TimeSpan ToTimeSpan(string dmtfTimespan) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
384public static readonly System.TimeSpan InfiniteTimeout;
386public System.TimeSpan Timeout { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } set { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } }
582public ObjectGetOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout, bool useAmendedQualifiers) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
652public PutOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout, bool useAmendedQualifiers, System.Management.PutType putType) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
768public WqlEventQuery(string eventClassName, string condition, System.TimeSpan groupWithinInterval) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
769public WqlEventQuery(string eventClassName, string condition, System.TimeSpan groupWithinInterval, string[] groupByPropertyList) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
770public WqlEventQuery(string eventClassName, System.TimeSpan withinInterval) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
771public WqlEventQuery(string eventClassName, System.TimeSpan withinInterval, string condition) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
772public WqlEventQuery(string eventClassName, System.TimeSpan withinInterval, string condition, System.TimeSpan groupWithinInterval, string[] groupByPropertyList, string havingCondition) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
776public System.TimeSpan GroupWithinInterval { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } set { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } }
780public System.TimeSpan WithinInterval { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } set { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } }
System.Net.Http (118)
System.Net.Http.Json (1)
System.Net.Http.WinHttpHandler (5)
System.Net.HttpListener (18)
System.Net.Mail (15)
System\Net\Mime\SmtpDateTime.cs (15)
62internal static readonly Dictionary<string, TimeSpan> s_timeZoneOffsetLookup = new Dictionary<string, TimeSpan>()
65{ "UT", TimeSpan.Zero }, // +0000
66{ "GMT", TimeSpan.Zero }, // +0000
79internal const long TimeSpanMaxTicks = TimeSpan.TicksPerHour * 99 + TimeSpan.TicksPerMinute * 59;
89private readonly TimeSpan _timeZone;
107TimeSpan localTimeZone = TimeZoneInfo.Local.GetUtcOffset(value);
116_timeZone = TimeSpan.Zero;
162TimeSpan timeZone = _timeZone;
294internal static bool TryParseTimeZoneString(string timeZoneString, out TimeSpan timeZone)
300timeZone = TimeSpan.Zero;
337internal static TimeSpan ValidateAndGetSanitizedTimeSpan(TimeSpan span)
340TimeSpan sanitizedTimeSpan = new TimeSpan(span.Days, span.Hours, span.Minutes, 0, 0);
System.Net.NameResolution (3)
System.Net.Ping (5)
System\Net\NetworkInformation\Ping.cs (5)
447public PingReply Send(IPAddress address, TimeSpan timeout, byte[]? buffer = null, PingOptions? options = null) =>
479public PingReply Send(string hostNameOrAddress, TimeSpan timeout, byte[]? buffer = null,
583public Task<PingReply> SendPingAsync(IPAddress address, TimeSpan timeout, byte[]? buffer = null, PingOptions? options = null, CancellationToken cancellationToken = default)
626public Task<PingReply> SendPingAsync(string hostNameOrAddress, TimeSpan timeout, byte[]? buffer = null, PingOptions? options = null, CancellationToken cancellationToken = default)
655private static int ToTimeoutMilliseconds(TimeSpan timeout)
System.Net.Quic (22)
System.Net.Requests (35)
System.Net.Security (15)
System.Net.ServerSentEvents (12)
System.Net.Sockets (6)
System.Net.WebSockets (34)
System.Net.WebSockets.Client (15)
System.Private.CoreLib (798)
src\libraries\Common\src\System\TimeProvider.cs (14)
59TimeSpan offset = zoneInfo.GetUtcOffset(utcDateTime);
104/// <returns>A <see cref="TimeSpan"/> for the elapsed time between the starting and ending timestamps.</returns>
105public TimeSpan GetElapsedTime(long startingTimestamp, long endingTimestamp)
117return new TimeSpan((long)((endingTimestamp - startingTimestamp) * ((double)TimeSpan.TicksPerSecond / timestampFrequency)));
124/// <returns>A <see cref="TimeSpan"/> for the elapsed time between the starting timestamp and the time of this call.</returns>
125public TimeSpan GetElapsedTime(long startingTimestamp) => GetElapsedTime(startingTimestamp, GetTimestamp());
127/// <summary>Creates a new <see cref="ITimer"/> instance, using <see cref="TimeSpan"/> values to measure time intervals.</summary>
133/// <param name="dueTime">The amount of time to delay before <paramref name="callback"/> is invoked. Specify <see cref="Timeout.InfiniteTimeSpan"/> to prevent the timer from starting. Specify <see cref="TimeSpan.Zero"/> to start the timer immediately.</param>
160public virtual ITimer CreateTimer(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period)
185public SystemTimeProviderTimer(TimeSpan dueTime, TimeSpan period, TimerCallback callback, object? state)
211public bool Change(TimeSpan dueTime, TimeSpan period)
src\libraries\System.Private.CoreLib\src\System\DateTime.cs (77)
78internal const long MaxTicks = DaysTo10000 * TimeSpan.TicksPerDay - 1;
79private const long MaxMicroseconds = MaxTicks / TimeSpan.TicksPerMicrosecond;
80private const long MaxMillis = MaxTicks / TimeSpan.TicksPerMillisecond;
81private const long MaxSeconds = MaxTicks / TimeSpan.TicksPerSecond;
82private const long MaxMinutes = MaxTicks / TimeSpan.TicksPerMinute;
83private const long MaxHours = MaxTicks / TimeSpan.TicksPerHour;
86internal const long UnixEpochTicks = DaysTo1970 * TimeSpan.TicksPerDay;
87private const long FileTimeOffset = DaysTo1601 * TimeSpan.TicksPerDay;
88private const long DoubleDateOffset = DaysTo1899 * TimeSpan.TicksPerDay;
91private const long OADateMinAsTicks = (DaysPer100Years - DaysPerYear) * TimeSpan.TicksPerDay;
105private const ulong TicksPer6Hours = TimeSpan.TicksPerHour * 6;
176_dateData = (ulong)(date.DayNumber * TimeSpan.TicksPerDay + time.Ticks);
195_dateData = (ulong)(date.DayNumber * TimeSpan.TicksPerDay + time.Ticks) | ((ulong)(uint)kind << KindShift);
207internal static void ThrowMillisecondOutOfRange() => throw new ArgumentOutOfRangeException("millisecond", SR.Format(SR.ArgumentOutOfRange_Range, 0, TimeSpan.MillisecondsPerSecond - 1));
208internal static void ThrowMicrosecondOutOfRange() => throw new ArgumentOutOfRangeException("microsecond", SR.Format(SR.ArgumentOutOfRange_Range, 0, TimeSpan.MicrosecondsPerMillisecond - 1));
290if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond) ThrowMillisecondOutOfRange();
425if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond) ThrowMillisecondOutOfRange();
426_dateData += (uint)millisecond * (uint)TimeSpan.TicksPerMillisecond;
485if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond) ThrowMillisecondOutOfRange();
486_dateData += (uint)millisecond * (uint)TimeSpan.TicksPerMillisecond;
679if ((uint)microsecond >= TimeSpan.MicrosecondsPerMillisecond) ThrowMicrosecondOutOfRange();
680_dateData += (uint)microsecond * (uint)TimeSpan.TicksPerMicrosecond;
808if ((uint)microsecond >= TimeSpan.MicrosecondsPerMillisecond) ThrowMicrosecondOutOfRange();
809_dateData += (uint)microsecond * (uint)TimeSpan.TicksPerMicrosecond;
860public DateTime Add(TimeSpan value)
888public DateTime AddDays(double value) => AddUnits(value, MaxDays, TimeSpan.TicksPerDay);
897public DateTime AddHours(double value) => AddUnits(value, MaxHours, TimeSpan.TicksPerHour);
906public DateTime AddMilliseconds(double value) => AddUnits(value, MaxMillis, TimeSpan.TicksPerMillisecond);
932public DateTime AddMicroseconds(double value) => AddUnits(value, MaxMicroseconds, TimeSpan.TicksPerMicrosecond);
941public DateTime AddMinutes(double value) => AddUnits(value, MaxMinutes, TimeSpan.TicksPerMinute);
976return new DateTime(n * (ulong)TimeSpan.TicksPerDay + date.UTicks % TimeSpan.TicksPerDay | date.InternalKind);
986public DateTime AddSeconds(double value) => AddUnits(value, MaxSeconds, TimeSpan.TicksPerSecond);
1043return new DateTime(n * (ulong)TimeSpan.TicksPerDay + date.UTicks % TimeSpan.TicksPerDay | date.InternalKind);
1097return n * (ulong)TimeSpan.TicksPerDay;
1119return (uint)totalSeconds * (ulong)TimeSpan.TicksPerSecond;
1126if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond) ThrowMillisecondOutOfRange();
1128ticks += (uint)millisecond * (uint)TimeSpan.TicksPerMillisecond;
1139if ((uint)microsecond >= TimeSpan.MicrosecondsPerMillisecond) ThrowMicrosecondOutOfRange();
1141ticks += (uint)microsecond * (uint)TimeSpan.TicksPerMicrosecond;
1167long millis = (long)(value * TimeSpan.MillisecondsPerDay + (value >= 0 ? 0.5 : -0.5));
1173millis -= (millis % TimeSpan.MillisecondsPerDay) * 2;
1176millis += DoubleDateOffset / TimeSpan.TicksPerMillisecond;
1179return millis * TimeSpan.TicksPerMillisecond;
1216if (ticks > TicksCeiling - TimeSpan.TicksPerDay)
1240ticks += TimeSpan.TicksPerDay;
1327TimeSpan offset = TimeZoneInfo.GetLocalUtcOffset(this, TimeZoneInfoOptions.NoThrowOnInvalidTime);
1346public DateTime Date => new((UTicks / TimeSpan.TicksPerDay * TimeSpan.TicksPerDay) | InternalKind);
1379ulong seconds = UTicks / TimeSpan.TicksPerSecond;
1390ulong milliseconds = UTicks / TimeSpan.TicksPerMillisecond;
1404ulong seconds = ticks / TimeSpan.TicksPerSecond;
1405tick = (int)(ticks - (seconds * TimeSpan.TicksPerSecond));
1435public DayOfWeek DayOfWeek => (DayOfWeek)(((uint)(UTicks / TimeSpan.TicksPerDay) + 1) % 7);
1454public int Hour => (int)((uint)(UTicks / TimeSpan.TicksPerHour) % 24);
1472public int Millisecond => (int)((UTicks / TimeSpan.TicksPerMillisecond) % 1000);
1477public int Microsecond => (int)((UTicks / TimeSpan.TicksPerMicrosecond) % 1000);
1482public int Nanosecond => (int)(UTicks % TimeSpan.TicksPerMicrosecond) * 100;
1487public int Minute => (int)((UTicks / TimeSpan.TicksPerMinute) % 60);
1529public int Second => (int)((UTicks / TimeSpan.TicksPerSecond) % 60);
1540public TimeSpan TimeOfDay => new TimeSpan((long)(UTicks % TimeSpan.TicksPerDay));
1650public TimeSpan Subtract(DateTime value)
1655public DateTime Subtract(TimeSpan value)
1667if (value < TimeSpan.TicksPerDay) // This is a fix for VB. They want the default day to be 1/1/0001 rather than 12/30/1899.
1673long millis = (value - DoubleDateOffset) / TimeSpan.TicksPerMillisecond;
1676long frac = millis % TimeSpan.MillisecondsPerDay;
1677if (frac != 0) millis -= (TimeSpan.MillisecondsPerDay + frac) * 2;
1679return (double)millis / TimeSpan.MillisecondsPerDay;
1855public static DateTime operator +(DateTime d, TimeSpan t)
1862public static DateTime operator -(DateTime d, TimeSpan t)
1869public static TimeSpan operator -(DateTime d1, DateTime d2) => new TimeSpan(d1.Ticks - d2.Ticks);
1989if ((uint)hour >= 24 || (uint)minute >= 60 || (uint)millisecond >= TimeSpan.MillisecondsPerSecond)
1999ulong ticks = (DaysToYear((uint)year) + days[month - 1] + (uint)day - 1) * (ulong)TimeSpan.TicksPerDay;
2003ticks += TimeToTicks(hour, minute, second) + (uint)millisecond * (uint)TimeSpan.TicksPerMillisecond;
2012ticks += TimeToTicks(hour, minute, 59) + 999 * TimeSpan.TicksPerMillisecond;
src\libraries\System.Private.CoreLib\src\System\DateTimeOffset.cs (65)
51internal const long MaxOffset = MaxOffsetMinutes * TimeSpan.TicksPerMinute;
54private const long UnixEpochSeconds = DateTime.UnixEpochTicks / TimeSpan.TicksPerSecond; // 62,135,596,800
55private const long UnixEpochMilliseconds = DateTime.UnixEpochTicks / TimeSpan.TicksPerMillisecond; // 62,135,596,800,000
57internal const long UnixMinSeconds = DateTime.MinTicks / TimeSpan.TicksPerSecond - UnixEpochSeconds;
58internal const long UnixMaxSeconds = DateTime.MaxTicks / TimeSpan.TicksPerSecond - UnixEpochSeconds;
75Debug.Assert((ulong)(validDateTime.Ticks + validOffsetMinutes * TimeSpan.TicksPerMinute) <= DateTime.MaxTicks);
81public DateTimeOffset(long ticks, TimeSpan offset) : this(ValidateOffset(offset), ValidateDate(new DateTime(ticks), offset))
85private static DateTimeOffset CreateValidateOffset(DateTime dateTime, TimeSpan offset) => new DateTimeOffset(ValidateOffset(offset), ValidateDate(dateTime, offset));
94TimeSpan offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
108public DateTimeOffset(DateTime dateTime, TimeSpan offset)
134public DateTimeOffset(DateOnly date, TimeOnly time, TimeSpan offset)
141public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, TimeSpan offset)
156private static DateTime WithLeapSecond(int year, int month, int day, int hour, int minute, TimeSpan offset)
166public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, TimeSpan offset)
169if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond) DateTime.ThrowMillisecondOutOfRange();
170_dateTime = DateTime.CreateUnchecked(UtcTicks + (uint)millisecond * (uint)TimeSpan.TicksPerMillisecond);
175public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar, TimeSpan offset)
191private static DateTime WithLeapSecond(Calendar calendar, int year, int month, int day, int hour, int minute, int millisecond, TimeSpan offset)
219/// the <see cref="DateTimeOffset(int, int, int, int, int, int, int, int, Calendar, TimeSpan)"/> constructor.
251public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond, TimeSpan offset)
254if ((uint)microsecond >= TimeSpan.MicrosecondsPerMillisecond) DateTime.ThrowMicrosecondOutOfRange();
255_dateTime = DateTime.CreateUnchecked(UtcTicks + (uint)microsecond * (uint)TimeSpan.TicksPerMicrosecond);
276/// the <see cref="DateTimeOffset(int, int, int, int, int, int, int, int, Calendar, TimeSpan)"/> constructor.
325public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond, Calendar calendar, TimeSpan offset)
328if ((uint)microsecond >= TimeSpan.MicrosecondsPerMillisecond) DateTime.ThrowMicrosecondOutOfRange();
329_dateTime = DateTime.CreateUnchecked(UtcTicks + (uint)microsecond * (uint)TimeSpan.TicksPerMicrosecond);
342public DateTimeOffset ToOffset(TimeSpan offset) => CreateValidateOffset(_dateTime + offset, offset);
349private DateTime ClockDateTime => DateTime.CreateUnchecked(UtcTicks + _offsetMinutes * TimeSpan.TicksPerMinute);
414public TimeSpan Offset => new TimeSpan(_offsetMinutes * TimeSpan.TicksPerMinute);
437public TimeSpan TimeOfDay => ClockDateTime.TimeOfDay;
447public DateTimeOffset Add(TimeSpan timeSpan) => Add(ClockDateTime.Add(timeSpan));
593long ticks = seconds * TimeSpan.TicksPerSecond + DateTime.UnixEpochTicks;
599const long MinMilliseconds = DateTime.MinTicks / TimeSpan.TicksPerMillisecond - UnixEpochMilliseconds;
600const long MaxMilliseconds = DateTime.MaxTicks / TimeSpan.TicksPerMillisecond - UnixEpochMilliseconds;
607long ticks = milliseconds * TimeSpan.TicksPerMillisecond + DateTime.UnixEpochTicks;
657out TimeSpan offset);
676out TimeSpan offset);
683DateTime dateResult = DateTimeParse.Parse(input, DateTimeFormatInfo.GetInstance(formatProvider), styles, out TimeSpan offset);
708out TimeSpan offset);
715DateTime dateResult = DateTimeParse.ParseExact(input, format, DateTimeFormatInfo.GetInstance(formatProvider), styles, out TimeSpan offset);
728out TimeSpan offset);
735DateTime dateResult = DateTimeParse.ParseExactMultiple(input, formats, DateTimeFormatInfo.GetInstance(formatProvider), styles, out TimeSpan offset);
739public TimeSpan Subtract(DateTimeOffset value) => new TimeSpan(UtcTicks - value.UtcTicks);
741public DateTimeOffset Subtract(TimeSpan value) => Add(ClockDateTime.Subtract(value));
763long seconds = (long)((ulong)UtcTicks / TimeSpan.TicksPerSecond);
771long milliseconds = (long)((ulong)UtcTicks / TimeSpan.TicksPerMillisecond);
779TimeSpan offset = TimeZoneInfo.GetLocalUtcOffset(utcDateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
819out TimeSpan offset);
826bool parsed = DateTimeParse.TryParse(input, DateTimeFormatInfo.CurrentInfo, DateTimeStyles.None, out DateTime dateResult, out TimeSpan offset);
844out TimeSpan offset);
852bool parsed = DateTimeParse.TryParse(input, DateTimeFormatInfo.GetInstance(formatProvider), styles, out DateTime dateResult, out TimeSpan offset);
872out TimeSpan offset);
881bool parsed = DateTimeParse.TryParseExact(input, format, DateTimeFormatInfo.GetInstance(formatProvider), styles, out DateTime dateResult, out TimeSpan offset);
901out TimeSpan offset);
910bool parsed = DateTimeParse.TryParseExactMultiple(input, formats, DateTimeFormatInfo.GetInstance(formatProvider), styles, out DateTime dateResult, out TimeSpan offset);
916private static int ValidateOffset(TimeSpan offset)
918long minutes = offset.Ticks / TimeSpan.TicksPerMinute;
919if (offset.Ticks != minutes * TimeSpan.TicksPerMinute)
933private static DateTime ValidateDate(DateTime dateTime, TimeSpan offset)
979public static DateTimeOffset operator +(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) =>
982public static DateTimeOffset operator -(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) =>
985public static TimeSpan operator -(DateTimeOffset left, DateTimeOffset right) =>
1011/// Deconstructs <see cref="DateTimeOffset"/> into <see cref="DateOnly"/>, <see cref="TimeOnly"/> and <see cref="TimeSpan"/>.
1023public void Deconstruct(out DateOnly date, out TimeOnly time, out TimeSpan offset)
src\libraries\System.Private.CoreLib\src\System\Globalization\Calendar.cs (10)
31internal const long MaxMillis = (long)DateTime.DaysTo10000 * TimeSpan.MillisecondsPerDay;
134long ticks = time.Ticks + millis * TimeSpan.TicksPerMillisecond;
160return Add(time, days, (int)TimeSpan.MillisecondsPerDay);
172return Add(time, hours, (int)TimeSpan.MillisecondsPerHour);
184return Add(time, minutes, (int)TimeSpan.MillisecondsPerMinute);
216return Add(time, seconds, (int)TimeSpan.MillisecondsPerSecond);
673if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond)
678SR.Format(SR.ArgumentOutOfRange_Range, 0, TimeSpan.MillisecondsPerSecond - 1));
682return totalSeconds * TimeSpan.TicksPerSecond + millisecond * TimeSpan.TicksPerMillisecond;
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (15)
429DateTime dateTime, scoped ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, TimeSpan offset, ref ValueListBuilder<TChar> result) where TChar : unmanaged, IUtfChar<TChar>
487int fraction = (int)(dateTime.Ticks % TimeSpan.TicksPerSecond);
787private static unsafe void FormatCustomizedTimeZone<TChar>(DateTime dateTime, TimeSpan offset, int tokenLen, bool timeOnly, ref ValueListBuilder<TChar> result) where TChar : unmanaged, IUtfChar<TChar>
795if (timeOnly && dateTime.Ticks < TimeSpan.TicksPerDay)
852private static unsafe void FormatCustomizedRoundripTimeZone<TChar>(DateTime dateTime, TimeSpan offset, ref ValueListBuilder<TChar> result) where TChar : unmanaged, IUtfChar<TChar>
920internal static string Format(DateTime dateTime, string? format, IFormatProvider? provider, TimeSpan offset)
1032internal static bool TryFormat<TChar>(DateTime dateTime, Span<TChar> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider, TimeSpan offset) where TChar : unmanaged, IUtfChar<TChar>
1147dateTime.Ticks < TimeSpan.TicksPerDay &&
1158private static void PrepareFormatU(ref DateTime dateTime, ref DateTimeFormatInfo dtfi, TimeSpan offset)
1442internal static unsafe bool TryFormatO<TChar>(DateTime dateTime, TimeSpan offset, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1493int offsetTotalMinutes = (int)(offset.Ticks / TimeSpan.TicksPerMinute);
1557internal static unsafe bool TryFormatu<TChar>(DateTime dateTime, TimeSpan offset, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1598internal static unsafe bool TryFormatR<TChar>(DateTime dateTime, TimeSpan offset, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1663internal static unsafe bool TryFormatInvariantG<TChar>(DateTime value, TimeSpan offset, Span<TChar> destination, out int bytesWritten) where TChar : unmanaged, IUtfChar<TChar>
1699int offsetMinutes = (int)(offset.Ticks / TimeSpan.TicksPerMinute);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeParse.cs (30)
34internal static DateTime ParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, DateTimeStyles style, out TimeSpan offset)
65internal static bool TryParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result, out TimeSpan offset)
79offset = TimeSpan.Zero;
118DateTimeFormatInfo dtfi, DateTimeStyles style, out TimeSpan offset)
135DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result, out TimeSpan offset)
149offset = TimeSpan.Zero;
495private static bool ParseTimeZone(ref __DTString str, scoped ref TimeSpan result)
2437internal static DateTime Parse(ReadOnlySpan<char> s, DateTimeFormatInfo dtfi, DateTimeStyles styles, out TimeSpan offset)
2468internal static bool TryParse(ReadOnlySpan<char> s, DateTimeFormatInfo dtfi, DateTimeStyles styles, out DateTime result, out TimeSpan offset)
2482offset = TimeSpan.Zero;
2697if (!time.TryAddTicks((long)Math.Round(raw.fraction * TimeSpan.TicksPerSecond), out time))
2787result.timeZoneOffset = TimeSpan.Zero;
2821result.timeZoneOffset = TimeSpan.Zero;
2859result.timeZoneOffset = TimeSpan.Zero;
2866result.timeZoneOffset = TimeSpan.Zero;
2884resultTicks += TimeSpan.TicksPerDay;
2909if (resultTicks < TimeSpan.TicksPerDay)
2922resultTicks += TimeSpan.TicksPerDay;
3017result.timeZoneOffset = TimeSpan.Zero;
3058if (!time.TryAddTicks((long)Math.Round(partSecond * TimeSpan.TicksPerSecond), out time))
3229private static bool ParseTimeZoneOffset(ref __DTString str, int len, scoped ref TimeSpan result)
4287TimeSpan tempTimeZoneOffset = new TimeSpan(0);
4303if ((result.flags & ParseFlags.TimeZoneUsed) != 0 && result.timeZoneOffset != TimeSpan.Zero)
4329if ((result.flags & ParseFlags.TimeZoneUsed) != 0 && result.timeZoneOffset != TimeSpan.Zero)
4342TimeSpan tempTimeZoneOffset = new TimeSpan(0);
4422result.timeZoneOffset = TimeSpan.Zero;
4486result.timeZoneOffset = TimeSpan.Zero;
4761if (!result.parsedDate.TryAddTicks((long)Math.Round(result.fraction * TimeSpan.TicksPerSecond), out result.parsedDate))
5106if (!dateTime.TryAddTicks((long)Math.Round(fraction * TimeSpan.TicksPerSecond), out result.parsedDate))
6104internal TimeSpan timeZoneOffset;
src\libraries\System.Private.CoreLib\src\System\Globalization\HebrewCalendar.cs (4)
569return new DateTime(ToDateTime(y, i, d, 0, 0, 0, 0).Ticks + (time.Ticks % TimeSpan.TicksPerDay));
600long ticks = ToDateTime(y, m, d, 0, 0, 0, 0).Ticks + (time.Ticks % TimeSpan.TicksPerDay);
650return (int)((time.Ticks - beginOfYearDate.Ticks) / TimeSpan.TicksPerDay) + 1;
828return new DateTime(gregorianNewYear.Ticks + days * TimeSpan.TicksPerDay + TimeToTicks(hour, minute, second, millisecond));
src\libraries\System.Private.CoreLib\src\System\Globalization\TimeSpanFormat.cs (13)
19internal static string Format(TimeSpan value, string? format, IFormatProvider? formatProvider)
51internal static bool TryFormat<TChar>(TimeSpan value, Span<TChar> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? formatProvider) where TChar : unmanaged, IUtfChar<TChar>
84internal static string FormatC(TimeSpan value)
91private static string FormatG(TimeSpan value, DateTimeFormatInfo dtfi, StandardFormat format)
109internal static unsafe bool TryFormatStandard<TChar>(TimeSpan value, StandardFormat format, ReadOnlySpan<TChar> decimalSeparator, Span<TChar> destination, out int written) where TChar : unmanaged, IUtfChar<TChar>
137(totalSecondsRemaining, fraction64) = Math.DivRem((ulong)ticks, TimeSpan.TicksPerSecond);
297private static void FormatCustomized<TChar>(TimeSpan value, scoped ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, ref ValueListBuilder<TChar> result) where TChar : unmanaged, IUtfChar<TChar>
301int day = (int)(value.Ticks / TimeSpan.TicksPerDay);
302long time = value.Ticks % TimeSpan.TicksPerDay;
309int hours = (int)(time / TimeSpan.TicksPerHour % 24);
310int minutes = (int)(time / TimeSpan.TicksPerMinute % 60);
311int seconds = (int)(time / TimeSpan.TicksPerSecond % 60);
312int fraction = (int)(time % TimeSpan.TicksPerSecond);
src\libraries\System.Private.CoreLib\src\System\Globalization\TimeSpanParse.cs (16)
495internal TimeSpan parsedTimeSpan;
607const long MaxMilliSeconds = long.MaxValue / TimeSpan.TicksPerMillisecond;
608const long MinMilliSeconds = long.MinValue / TimeSpan.TicksPerMillisecond;
617result = ticks * TimeSpan.TicksPerMillisecond + fraction._num;
627internal static TimeSpan Parse(ReadOnlySpan<char> input, IFormatProvider? formatProvider)
635internal static bool TryParse(ReadOnlySpan<char> input, IFormatProvider? formatProvider, out TimeSpan result)
649internal static TimeSpan ParseExact(ReadOnlySpan<char> input, ReadOnlySpan<char> format, IFormatProvider? formatProvider, TimeSpanStyles styles)
657internal static bool TryParseExact(ReadOnlySpan<char> input, ReadOnlySpan<char> format, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
671internal static TimeSpan ParseExactMultiple(ReadOnlySpan<char> input, string?[]? formats, IFormatProvider? formatProvider, TimeSpanStyles styles)
679internal static bool TryParseExactMultiple(ReadOnlySpan<char> input, string?[]? formats, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
1522if (!ParseInt((int)(0x7FFFFFFFFFFFFFFFL / TimeSpan.TicksPerDay), out int days, ref result))
1527time = days * TimeSpan.TicksPerDay;
1610time = unit * TimeSpan.TicksPerHour;
1623time += unit * TimeSpan.TicksPerMinute;
1636time += unit * TimeSpan.TicksPerSecond;
1642int f = (int)TimeSpan.TicksPerSecond;
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (25)
2639/// A <see cref="TimeSpan"/> that represents the number of milliseconds to wait, or a <see
2640/// cref="TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
2654public bool Wait(TimeSpan timeout) => Wait(timeout, default);
2678public bool Wait(TimeSpan timeout, CancellationToken cancellationToken)
2800public Task WaitAsync(TimeSpan timeout) => WaitAsync(ValidateTimeout(timeout, ExceptionArgument.timeout), TimeProvider.System, default);
2807public Task WaitAsync(TimeSpan timeout, TimeProvider timeProvider)
2817public Task WaitAsync(TimeSpan timeout, CancellationToken cancellationToken) =>
2826public Task WaitAsync(TimeSpan timeout, TimeProvider timeProvider, CancellationToken cancellationToken)
2891_timer = timeProvider.CreateTimer(callback, this, TimeSpan.FromMilliseconds(millisecondsDelay), Timeout.InfiniteTimeSpan);
4751/// A <see cref="TimeSpan"/> that represents the number of milliseconds to wait, or a <see
4752/// cref="TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
4771public static bool WaitAll(Task[] tasks, TimeSpan timeout)
5196/// A <see cref="TimeSpan"/> that represents the number of milliseconds to wait, or a <see
5197/// cref="TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
5215public static int WaitAny(Task[] tasks, TimeSpan timeout)
5685public static Task Delay(TimeSpan delay) => Delay(delay, TimeProvider.System, default);
5688/// <param name="delay">The <see cref="TimeSpan"/> to wait before completing the returned task, or <see cref="Timeout.InfiniteTimeSpan"/> to wait indefinitely.</param>
5692/// <exception cref="ArgumentOutOfRangeException"><paramref name="delay"/>'s <see cref="TimeSpan.TotalMilliseconds"/> property is greater than 4294967294.</exception>
5694public static Task Delay(TimeSpan delay, TimeProvider timeProvider) => Delay(delay, timeProvider, default);
5714public static Task Delay(TimeSpan delay, CancellationToken cancellationToken) =>
5718/// <param name="delay">The <see cref="TimeSpan"/> to wait before completing the returned task, or <see cref="Timeout.InfiniteTimeSpan"/> to wait indefinitely.</param>
5723/// <exception cref="ArgumentOutOfRangeException"><paramref name="delay"/>'s <see cref="TimeSpan.TotalMilliseconds"/> property is greater than 4294967294.</exception>
5725public static Task Delay(TimeSpan delay, TimeProvider timeProvider, CancellationToken cancellationToken)
5779internal static uint ValidateTimeout(TimeSpan timeout, ExceptionArgument argument)
5816_timer = timeProvider.CreateTimer(s_timerCallback, this, TimeSpan.FromMilliseconds(millisecondsDelay), Timeout.InfiniteTimeSpan);
src\libraries\System.Private.CoreLib\src\System\Threading\Timer.cs (16)
491internal TimerQueueTimer(TimerCallback timerCallback, object? state, TimeSpan dueTime, TimeSpan period, bool flowExecutionContext) :
496private static uint GetMilliseconds(TimeSpan time, [CallerArgumentExpression(nameof(time))] string? parameter = null)
533"DueTime = " + (_dueTime == Timeout.UnsignedInfinite ? "(not set)" : TimeSpan.FromMilliseconds(_dueTime)) + ", " +
534"Period = " + (_period == Timeout.UnsignedInfinite ? "(not set)" : TimeSpan.FromMilliseconds(_period)) + ", " +
539public bool Change(TimeSpan dueTime, TimeSpan period) =>
763return (TimerQueue.s_tickCountToTimeMap.Time + TimeSpan.FromMilliseconds(msOffset));
770public TimeSpan? DueTime => _timer._dueTime == Timeout.UnsignedInfinite ? null : TimeSpan.FromMilliseconds(_timer._dueTime);
772public TimeSpan? Period => _timer._period == Timeout.UnsignedInfinite ? null : TimeSpan.FromMilliseconds(_timer._period);
853TimeSpan dueTime,
854TimeSpan period)
919public bool Change(TimeSpan dueTime, TimeSpan period) =>
src\libraries\System.Private.CoreLib\src\System\Threading\WaitHandle.cs (8)
79internal static int ToTimeoutMilliseconds(TimeSpan timeout)
502public virtual bool WaitOne(TimeSpan timeout) => WaitOneNoCheck(ToTimeoutMilliseconds(timeout));
505public virtual bool WaitOne(TimeSpan timeout, bool exitContext) => WaitOneNoCheck(ToTimeoutMilliseconds(timeout));
509public static bool WaitAll(WaitHandle[] waitHandles, TimeSpan timeout) =>
515public static bool WaitAll(WaitHandle[] waitHandles, TimeSpan timeout, bool exitContext) =>
524public static int WaitAny(WaitHandle[] waitHandles, TimeSpan timeout) =>
530public static int WaitAny(WaitHandle[] waitHandles, TimeSpan timeout, bool exitContext) =>
535public static bool SignalAndWait(WaitHandle toSignal, WaitHandle toWaitOn, TimeSpan timeout, bool exitContext) =>
src\libraries\System.Private.CoreLib\src\System\TimeSpan.cs (140)
31IComparable<TimeSpan>,
32IEquatable<TimeSpan>,
34ISpanParsable<TimeSpan>,
236public static readonly TimeSpan Zero = new TimeSpan(0);
238public static readonly TimeSpan MaxValue = new TimeSpan(MaxTicks);
239public static readonly TimeSpan MinValue = new TimeSpan(MinTicks);
261/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
274/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
282/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
296/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
323/// Gets the microseconds component of the time interval represented by the current <see cref="TimeSpan"/> structure.
332/// Gets the nanoseconds component of the time interval represented by the current <see cref="TimeSpan"/> structure.
368/// Gets the value of the current <see cref="TimeSpan"/> structure expressed in whole and fractional microseconds.
380/// Gets the value of the current <see cref="TimeSpan"/> structure expressed in whole and fractional nanoseconds.
395public TimeSpan Add(TimeSpan ts) => this + ts;
400public static int Compare(TimeSpan t1, TimeSpan t2) => t1._ticks.CompareTo(t2._ticks);
410if (value is TimeSpan other)
418public int CompareTo(TimeSpan value) => Compare(this, value);
420public static TimeSpan FromDays(double value) => Interval(value, TicksPerDay);
422public TimeSpan Duration()
431public override bool Equals([NotNullWhen(true)] object? value) => (value is TimeSpan other) && Equals(other);
433public bool Equals(TimeSpan obj) => Equals(this, obj);
435public static bool Equals(TimeSpan t1, TimeSpan t2) => t1 == t2;
440private static TimeSpan FromUnits(long units, long ticksPerUnit, long minUnits, long maxUnits)
449return TimeSpan.FromTicks(units * ticksPerUnit);
453/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
457/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of days.</returns>
459/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
461public static TimeSpan FromDays(int days) => FromUnits(days, TicksPerDay, MinDays, MaxDays);
464/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
473/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of days, hours, minutes, seconds, milliseconds, and microseconds.</returns>
475/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
477public static TimeSpan FromDays(int days, int hours = 0, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0)
490/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
494/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of hours.</returns>
496/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
498public static TimeSpan FromHours(int hours) => FromUnits(hours, TicksPerHour, MinHours, MaxHours);
501/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
509/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of hours, minutes, seconds, milliseconds, and microseconds.</returns>
511/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
513public static TimeSpan FromHours(int hours, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0)
525/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
529/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of minutes.</returns>
531/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
533public static TimeSpan FromMinutes(long minutes) => FromUnits(minutes, TicksPerMinute, MinMinutes, MaxMinutes);
536/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
543/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of minutes, seconds, milliseconds, and microseconds.</returns>
545/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
547public static TimeSpan FromMinutes(long minutes, long seconds = 0, long milliseconds = 0, long microseconds = 0)
558/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
562/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of seconds.</returns>
564/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
566public static TimeSpan FromSeconds(long seconds) => FromUnits(seconds, TicksPerSecond, MinSeconds, MaxSeconds);
569/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
575/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of seconds, milliseconds, and microseconds.</returns>
577/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
579public static TimeSpan FromSeconds(long seconds, long milliseconds = 0, long microseconds = 0)
589/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
593/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of milliseconds.</returns>
595/// The parameter specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
597public static TimeSpan FromMilliseconds(long milliseconds)
601/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
606/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of milliseconds, and microseconds.</returns>
608/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
610public static TimeSpan FromMilliseconds(long milliseconds, long microseconds)
619private static TimeSpan FromMicroseconds(Int128 microseconds)
626return TimeSpan.FromTicks(ticks);
630/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
634/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of microseconds.</returns>
636/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
638public static TimeSpan FromMicroseconds(long microseconds) => FromUnits(microseconds, TicksPerMicrosecond, MinMicroseconds, MaxMicroseconds);
640public static TimeSpan FromHours(double value) => Interval(value, TicksPerHour);
642private static TimeSpan Interval(double value, double scale)
651private static TimeSpan IntervalFromDoubleTicks(double ticks)
664public static TimeSpan FromMilliseconds(double value) => Interval(value, TicksPerMillisecond);
667/// Returns a <see cref="TimeSpan"/> that represents a specified number of microseconds.
685public static TimeSpan FromMicroseconds(double value) => Interval(value, TicksPerMicrosecond);
687public static TimeSpan FromMinutes(double value) => Interval(value, TicksPerMinute);
689public TimeSpan Negate() => -this;
691public static TimeSpan FromSeconds(double value) => Interval(value, TicksPerSecond);
693public TimeSpan Subtract(TimeSpan ts) => this - ts;
695public TimeSpan Multiply(double factor) => this * factor;
697public TimeSpan Divide(double divisor) => this / divisor;
699public double Divide(TimeSpan ts) => this / ts;
701public static TimeSpan FromTicks(long value) => new TimeSpan(value);
728public static TimeSpan Parse(string s)
734public static TimeSpan Parse(string input, IFormatProvider? formatProvider)
742public static TimeSpan Parse(ReadOnlySpan<char> input, IFormatProvider? formatProvider = null) => TimeSpanParse.Parse(input, formatProvider);
743public static TimeSpan ParseExact(string input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string format, IFormatProvider? formatProvider)
749public static TimeSpan ParseExact(string input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string[] formats, IFormatProvider? formatProvider)
757public static TimeSpan ParseExact(string input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string format, IFormatProvider? formatProvider, TimeSpanStyles styles)
765public static TimeSpan ParseExact(ReadOnlySpan<char> input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] ReadOnlySpan<char> format, IFormatProvider? formatProvider, TimeSpanStyles styles = TimeSpanStyles.None)
770public static TimeSpan ParseExact(string input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string[] formats, IFormatProvider? formatProvider, TimeSpanStyles styles)
776public static TimeSpan ParseExact(ReadOnlySpan<char> input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string[] formats, IFormatProvider? formatProvider, TimeSpanStyles styles = TimeSpanStyles.None)
781public static bool TryParse([NotNullWhen(true)] string? s, out TimeSpan result)
790public static bool TryParse(ReadOnlySpan<char> s, out TimeSpan result) => TimeSpanParse.TryParse(s, null, out result);
792public static bool TryParse([NotNullWhen(true)] string? input, IFormatProvider? formatProvider, out TimeSpan result)
801public static bool TryParse(ReadOnlySpan<char> input, IFormatProvider? formatProvider, out TimeSpan result) => TimeSpanParse.TryParse(input, formatProvider, out result);
802public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string? format, IFormatProvider? formatProvider, out TimeSpan result)
812public static bool TryParseExact(ReadOnlySpan<char> input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] ReadOnlySpan<char> format, IFormatProvider? formatProvider, out TimeSpan result)
815public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string?[]? formats, IFormatProvider? formatProvider, out TimeSpan result)
824public static bool TryParseExact(ReadOnlySpan<char> input, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string?[]? formats, IFormatProvider? formatProvider, out TimeSpan result)
827public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string? format, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
839public static bool TryParseExact(ReadOnlySpan<char> input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] ReadOnlySpan<char> format, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
844public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string?[]? formats, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
856public static bool TryParseExact(ReadOnlySpan<char> input, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string?[]? formats, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
874public static TimeSpan operator -(TimeSpan t)
883public static TimeSpan operator -(TimeSpan t1, TimeSpan t2)
897public static TimeSpan operator +(TimeSpan t) => t;
899public static TimeSpan operator +(TimeSpan t1, TimeSpan t2)
914public static TimeSpan operator *(TimeSpan timeSpan, double factor)
928public static TimeSpan operator *(double factor, TimeSpan timeSpan) => timeSpan * factor;
931public static TimeSpan operator /(TimeSpan timeSpan, double divisor)
947public static double operator /(TimeSpan t1, TimeSpan t2) => t1.Ticks / (double)t2.Ticks;
950public static bool operator ==(TimeSpan t1, TimeSpan t2) => t1._ticks == t2._ticks;
953public static bool operator !=(TimeSpan t1, TimeSpan t2) => t1._ticks != t2._ticks;
956public static bool operator <(TimeSpan t1, TimeSpan t2) => t1._ticks < t2._ticks;
959public static bool operator <=(TimeSpan t1, TimeSpan t2) => t1._ticks <= t2._ticks;
962public static bool operator >(TimeSpan t1, TimeSpan t2) => t1._ticks > t2._ticks;
965public static bool operator >=(TimeSpan t1, TimeSpan t2) => t1._ticks >= t2._ticks;
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.AdjustmentRule.cs (29)
14private static readonly TimeSpan DaylightDeltaAdjustment = TimeSpan.FromHours(24.0);
15private static readonly TimeSpan MaxDaylightDelta = TimeSpan.FromHours(12.0);
18private readonly TimeSpan _daylightDelta;
21private readonly TimeSpan _baseUtcOffsetDelta; // delta from the default Utc offset (utcOffset = defaultUtcOffset + _baseUtcOffsetDelta)
28public TimeSpan DaylightDelta => _daylightDelta;
37public TimeSpan BaseUtcOffsetDelta => _baseUtcOffsetDelta;
46DaylightDelta != TimeSpan.Zero ||
70TimeSpan daylightDelta,
73TimeSpan baseUtcOffsetDelta,
101TimeSpan daylightDelta,
104TimeSpan baseUtcOffsetDelta)
119TimeSpan daylightDelta,
129baseUtcOffsetDelta: TimeSpan.Zero,
136TimeSpan daylightDelta,
139TimeSpan baseUtcOffsetDelta,
160DaylightTransitionStart.TimeOfDay.TimeOfDay.Ticks < TimeSpan.TicksPerSecond; // < 12:00:01 AM
169DaylightTransitionEnd.TimeOfDay.TimeOfDay.Ticks < TimeSpan.TicksPerSecond; // < 12:00:01 AM
177TimeSpan daylightDelta,
211if (daylightDelta.Ticks % TimeSpan.TicksPerMinute != 0)
216if (dateStart != DateTime.MinValue && dateStart.Kind == DateTimeKind.Unspecified && dateStart.TimeOfDay != TimeSpan.Zero)
221if (dateEnd != DateTime.MaxValue && dateEnd.Kind == DateTimeKind.Unspecified && dateEnd.TimeOfDay != TimeSpan.Zero)
230private static void AdjustDaylightDeltaToExpectedRange(ref TimeSpan daylightDelta, ref TimeSpan baseUtcOffsetDelta)
282_daylightDelta = (TimeSpan)info.GetValue("DaylightDelta", typeof(TimeSpan))!; // Do not rename (binary serialization)
286object? o = info.GetValueNoThrow("BaseUtcOffsetDelta", typeof(TimeSpan)); // Do not rename (binary serialization)
289_baseUtcOffsetDelta = (TimeSpan)o;
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (73)
50private readonly TimeSpan _baseUtcOffset;
186public TimeSpan BaseUtcOffset => _baseUtcOffset;
194public TimeSpan[] GetAmbiguousTimeOffsets(DateTimeOffset dateTimeOffset)
217TimeSpan[] timeSpans = new TimeSpan[2];
219TimeSpan actualUtcOffset = _baseUtcOffset + rule!.BaseUtcOffsetDelta;
222if (rule.DaylightDelta > TimeSpan.Zero)
239public TimeSpan[] GetAmbiguousTimeOffsets(DateTime dateTime)
276TimeSpan[] timeSpans = new TimeSpan[2];
277TimeSpan actualUtcOffset = _baseUtcOffset + rule!.BaseUtcOffsetDelta;
280if (rule.DaylightDelta > TimeSpan.Zero)
342public TimeSpan GetUtcOffset(DateTimeOffset dateTimeOffset) =>
348public TimeSpan GetUtcOffset(DateTime dateTime) =>
352internal static TimeSpan GetLocalUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags)
361internal TimeSpan GetUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags) =>
364private TimeSpan GetUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags, CachedData cachedData)
711TimeSpan destinationOffset = GetUtcOffsetFromUtc(utcDateTime, destinationTimeZone);
771TimeSpan sourceOffset = sourceTimeZone.BaseUtcOffset;
789sourceOffset += (sourceIsDaylightSavings ? sourceRule.DaylightDelta : TimeSpan.Zero /*FUTURE: sourceRule.StandardDelta*/);
1002TimeSpan baseUtcOffset,
1028TimeSpan baseUtcOffset,
1052TimeSpan baseUtcOffset,
1073TimeSpan baseUtcOffset,
1165_baseUtcOffset = (TimeSpan)info.GetValue("BaseUtcOffset", typeof(TimeSpan))!; // Do not rename (binary serialization)
1278private DateTime ConvertToUtc(DateTime dateTime, TimeSpan daylightDelta, TimeSpan baseUtcOffsetDelta) =>
1284private DateTime ConvertFromUtc(DateTime dateTime, TimeSpan daylightDelta, TimeSpan baseUtcOffsetDelta) =>
1290private DateTime ConvertToFromUtc(DateTime dateTime, TimeSpan daylightDelta, TimeSpan baseUtcOffsetDelta, bool convertToUtc)
1292TimeSpan offset = BaseUtcOffset + daylightDelta + baseUtcOffsetDelta;
1320TimeSpan offset = GetUtcOffsetFromUtc(utcConverted, destinationTimeZone, out isAmbiguousLocalDst);
1334TimeSpan delta = rule.DaylightDelta;
1402bool invalidAtStart = rule.DaylightDelta > TimeSpan.Zero;
1406daylightTime.Start + (invalidAtStart ? rule.DaylightDelta : TimeSpan.Zero); /* FUTURE: - rule.StandardDelta; */
1410daylightTime.End + (invalidAtStart ? -rule.DaylightDelta : TimeSpan.Zero);
1434private TimeSpan GetDaylightSavingsStartOffsetFromUtc(TimeSpan baseUtcOffset, AdjustmentRule rule, int? ruleIndex)
1451private static TimeSpan GetDaylightSavingsEndOffsetFromUtc(TimeSpan baseUtcOffset, AdjustmentRule rule)
1461private static bool GetIsDaylightSavingsFromUtc(DateTime time, int year, TimeSpan utc, AdjustmentRule rule, int? ruleIndex, out bool isAmbiguousLocalDst, TimeZoneInfo zone)
1485TimeSpan dstStartOffset = zone.GetDaylightSavingsStartOffsetFromUtc(utc, rule, ruleIndex);
1503TimeSpan dstEndOffset = GetDaylightSavingsEndOffsetFromUtc(utc, rule);
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)
1703if (rule == null || rule.DaylightDelta == TimeSpan.Zero)
1712if (rule.DaylightDelta > TimeSpan.Zero)
1773if (rule == null || rule.DaylightDelta == TimeSpan.Zero)
1782if (rule.DaylightDelta < TimeSpan.Zero)
1836private static TimeSpan GetUtcOffset(DateTime time, TimeZoneInfo zone)
1838TimeSpan baseOffset = zone.BaseUtcOffset;
1848baseOffset += (isDaylightSavings ? rule.DaylightDelta : TimeSpan.Zero /* FUTURE: rule.StandardDelta */);
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)
1877TimeSpan baseOffset = zone.BaseUtcOffset;
1912baseOffset += (isDaylightSavings ? rule.DaylightDelta : TimeSpan.Zero /* FUTURE: rule.StandardDelta */);
1925TimeSpan timeOfDay = transitionTime.TimeOfDay.TimeOfDay;
2157private static void ValidateTimeZoneInfo(string id, TimeSpan baseUtcOffset, AdjustmentRule[]? adjustmentRules, out bool adjustmentRulesSupportDst)
2166if (baseUtcOffset.Ticks % TimeSpan.TicksPerMinute != 0)
2207private static TimeSpan MaxOffset => TimeSpan.FromHours(14);
2208private static TimeSpan MinOffset => TimeSpan.FromHours(-14);
2213internal static bool UtcOffsetOutOfRange(TimeSpan offset) =>
2216private static TimeSpan GetUtcOffset(TimeSpan baseUtcOffset, AdjustmentRule adjustmentRule)
2220+ (adjustmentRule.HasDaylightSaving ? adjustmentRule.DaylightDelta : TimeSpan.Zero);
2226private static bool IsValidAdjustmentRuleOffset(TimeSpan baseUtcOffset, AdjustmentRule adjustmentRule)
2228TimeSpan utcOffset = GetUtcOffset(baseUtcOffset, adjustmentRule);
2237return CreateCustomTimeZone(UtcId, TimeSpan.Zero, displayName, standardDisplayName);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (48)
64_baseUtcOffset = TimeSpan.Zero;
116if (_baseUtcOffset.Ticks % TimeSpan.TicksPerMinute != 0)
139private static DateTime GetTimeOnlyInMillisecondsPrecision(DateTime input) => new DateTime((input.TimeOfDay.Ticks / TimeSpan.TicksPerMillisecond) * TimeSpan.TicksPerMillisecond);
163rule.DaylightDelta == TimeSpan.Zero && rule.BaseUtcOffsetDelta == TimeSpan.Zero)
238string? displayName = string.Create(null, stackalloc char[256], $"(UTC{(_baseUtcOffset >= TimeSpan.Zero ? '+' : '-')}{_baseUtcOffset:hh\\:mm}) {_id}");
358internal static TimeSpan GetDateTimeNowUtcOffsetFromUtc(DateTime time, out bool isAmbiguousLocalDst)
493private static void TZif_GenerateAdjustmentRules(out AdjustmentRule[]? rules, TimeSpan baseUtcOffset, DateTime[] dts, byte[] typeOfLocalTime,
516private static void TZif_GenerateAdjustmentRule(ref int index, TimeSpan timeZoneBaseUtcOffset, List<AdjustmentRule> rulesList, DateTime[] dts,
546TimeSpan transitionOffset = TZif_CalculateTransitionOffsetFromBase(transitionType.UtcOffset, timeZoneBaseUtcOffset);
547TimeSpan daylightDelta = transitionType.IsDst ? transitionOffset : TimeSpan.Zero;
548TimeSpan baseUtcDelta = transitionType.IsDst ? TimeSpan.Zero : transitionOffset;
573TimeSpan transitionOffset = TZif_CalculateTransitionOffsetFromBase(startTransitionType.UtcOffset, timeZoneBaseUtcOffset);
574TimeSpan daylightDelta = startTransitionType.IsDst ? transitionOffset : TimeSpan.Zero;
575TimeSpan baseUtcDelta = startTransitionType.IsDst ? TimeSpan.Zero : transitionOffset;
625TimeSpan transitionOffset = TZif_CalculateTransitionOffsetFromBase(transitionType.UtcOffset, timeZoneBaseUtcOffset);
626TimeSpan daylightDelta = transitionType.IsDst ? transitionOffset : TimeSpan.Zero;
627TimeSpan baseUtcDelta = transitionType.IsDst ? TimeSpan.Zero : transitionOffset;
650private static TimeSpan TZif_CalculateTransitionOffsetFromBase(TimeSpan transitionOffset, TimeSpan timeZoneBaseUtcOffset)
652TimeSpan result = transitionOffset - timeZoneBaseUtcOffset;
656if (result.Ticks % TimeSpan.TicksPerMinute != 0)
699private static AdjustmentRule? TZif_CreateAdjustmentRuleForPosixFormat(string posixFormat, DateTime startTransitionDate, TimeSpan timeZoneBaseUtcOffset)
713TimeSpan? parsedBaseOffset = TZif_ParseOffsetString(standardOffset);
716TimeSpan baseOffset = parsedBaseOffset.GetValueOrDefault().Negate(); // offsets are backwards in POSIX notation
722TimeSpan? parsedDaylightSavings = TZif_ParseOffsetString(daylightSavingsOffset);
723TimeSpan daylightSavingsTimeSpan;
759TimeSpan.Zero,
771private static TimeSpan? TZif_ParseOffsetString(ReadOnlySpan<char> offset)
773TimeSpan? result = null;
793TimeSpan parsedTimeSpan;
794if (TimeSpan.TryParseExact(offset, "g", CultureInfo.InvariantCulture, out parsedTimeSpan))
812TimeSpan? timeOffset = TZif_ParseOffsetString(time);
820if (timeOffset.GetValueOrDefault() < TimeSpan.Zero)
1245private static void NormalizeAdjustmentRuleOffset(TimeSpan baseUtcOffset, [NotNull] ref AdjustmentRule adjustmentRule)
1265TimeSpan utcOffset = GetUtcOffset(baseUtcOffset, adjustmentRule);
1268TimeSpan adjustment = TimeSpan.Zero;
1279if (adjustment != TimeSpan.Zero)
1296public readonly TimeSpan UtcOffset;
System.Private.DataContractSerialization (78)
System\Runtime\Serialization\Json\XmlJsonWriter.cs (5)
301public override void WriteArray(string? prefix, string localName, string? namespaceUri, TimeSpan[] array, int offset, int count)
351public override void WriteArray(string? prefix, XmlDictionaryString localName, XmlDictionaryString? namespaceUri, TimeSpan[] array, int offset, int count)
1013public override void WriteValue(TimeSpan value)
1426else if (value is TimeSpan)
1428WriteValue((TimeSpan)value);
System\Xml\ArrayHelper.cs (6)
371internal sealed class TimeSpanArrayHelperWithString : ArrayHelper<string, TimeSpan>
375protected override int ReadArray(XmlDictionaryReader reader, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
380protected override void WriteArray(XmlDictionaryWriter writer, string prefix, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
386internal sealed class TimeSpanArrayHelperWithDictionaryString : ArrayHelper<XmlDictionaryString, TimeSpan>
390protected override int ReadArray(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
395protected override void WriteArray(XmlDictionaryWriter writer, string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
System\Xml\XmlBinaryReader.cs (7)
250public override TimeSpan ReadElementContentAsTimeSpan()
257TimeSpan value = BufferReader.ReadTimeSpan();
1193type = typeof(TimeSpan);
1464private int ReadArray(TimeSpan[] array, int offset, int count)
1470foreach (ref TimeSpan item in array.AsSpan(offset, actual))
1478public override int ReadArray(string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
1485public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
System\Xml\XmlDictionaryAsyncCheckWriter.cs (3)
535public override void WriteValue(TimeSpan value)
676public override void WriteArray(string? prefix, string localName, string? namespaceUri, TimeSpan[] array, int offset, int count)
682public override void WriteArray(string? prefix, XmlDictionaryString localName, XmlDictionaryString? namespaceUri, TimeSpan[] array, int offset, int count)
System\Xml\XmlDictionaryReader.cs (7)
669public virtual TimeSpan ReadContentAsTimeSpan()
921public virtual TimeSpan ReadElementContentAsTimeSpan()
924TimeSpan value;
1285public virtual TimeSpan[] ReadTimeSpanArray(string localName, string namespaceUri)
1290public virtual TimeSpan[] ReadTimeSpanArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri)
1295public virtual int ReadArray(string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
1307public virtual int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
System\Xml\XmlDictionaryWriter.cs (5)
186public virtual void WriteValue(TimeSpan value)
310else if (type == typeof(TimeSpan))
339else if (type == typeof(TimeSpan))
602public virtual void WriteArray(string? prefix, string localName, string? namespaceUri, TimeSpan[] array, int offset, int count)
613public virtual void WriteArray(string? prefix, XmlDictionaryString localName, XmlDictionaryString? namespaceUri, TimeSpan[] array, int offset, int count)
System.Private.Windows.Core (32)
System.Private.Windows.Core.Tests (15)
System\Private\Windows\Ole\BinaryFormatUtilitiesTests.cs (15)
48TimeSpan.FromHours(1),
81new List<TimeSpan> { TimeSpan.MinValue, TimeSpan.MaxValue },
101new TimeSpan[] { TimeSpan.MinValue, TimeSpan.MaxValue },
123(ArrayList)([TimeSpan.MinValue, TimeSpan.MaxValue]),
143new Hashtable { { "TimeSpan", TimeSpan.FromHours(1) } },
749("System.Collections.Generic.List`1[[System.TimeSpan, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]", typeof(List<TimeSpan>))
999public TimeSpan[] TimeSpanArray = [TimeSpan.FromHours(1)];
1025public List<TimeSpan> TimeSpans = [TimeSpan.FromHours(1)];
System.Private.Xml (102)
System\Xml\Schema\FacetChecker.cs (17)
822internal virtual Exception? CheckValueFacets(TimeSpan value, XmlSchemaDatatype datatype)
1200TimeSpan timeSpanValue = (TimeSpan)datatype.ValueConverter.ChangeType(value, typeof(TimeSpan));
1204internal override Exception? CheckValueFacets(TimeSpan value, XmlSchemaDatatype datatype)
1211if (TimeSpan.Compare(value, (TimeSpan)restriction!.MaxInclusive!) > 0)
1219if (TimeSpan.Compare(value, (TimeSpan)restriction!.MaxExclusive!) >= 0)
1227if (TimeSpan.Compare(value, (TimeSpan)restriction!.MinInclusive!) < 0)
1235if (TimeSpan.Compare(value, (TimeSpan)restriction!.MinExclusive!) <= 0)
1251return MatchEnumeration((TimeSpan)value, enumeration);
1254private static bool MatchEnumeration(TimeSpan value, ArrayList enumeration)
1258if (TimeSpan.Compare(value, (TimeSpan)enumeration[i]!) == 0)
System.Private.Xml.Linq (19)
System.Resources.Extensions (7)
System.Resources.Writer (2)
System.Runtime (1)
System.Runtime.Caching (36)
System.Runtime.Serialization.Formatters (1)
System.Security.Cryptography (43)
System.ServiceModel.Federation (83)
System\IdentityModel\Security\WrapperSecurityCommunicationObject.cs (28)
35protected override TimeSpan DefaultCloseTimeout
40protected override TimeSpan DefaultOpenTimeout
50protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
55protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
60protected override void OnClose(TimeSpan timeout)
93protected override void OnOpen(TimeSpan timeout)
110internal Task OnCloseAsync(TimeSpan timeout)
115internal Task OnOpenAsync(TimeSpan timeout)
208public virtual TimeSpan DefaultOpenTimeout
213public virtual TimeSpan DefaultCloseTimeout
229public void Close(TimeSpan timeout)
239public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
254public void Open(TimeSpan timeout)
264public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
284public virtual Task OnCloseAsync(TimeSpan timeout)
302public virtual Task OnOpenAsync(TimeSpan timeout)
360public virtual TimeSpan DefaultOpenTimeout
365public virtual TimeSpan DefaultCloseTimeout
381public void Close(TimeSpan timeout)
391public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
406public void Open(TimeSpan timeout)
416public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
436public IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
441public IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
446public virtual void OnClose(TimeSpan timeout)
450public Task OnCloseAsync(TimeSpan timeout)
478public virtual void OnOpen(TimeSpan timeout)
482public Task OnOpenAsync(TimeSpan timeout)
System.ServiceModel.Http.Tests (64)
ServiceModel\BasicHttpBindingTest.cs (36)
29Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.CloseTimeout);
30Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.OpenTimeout);
31Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(10), binding.ReceiveTimeout);
32Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.SendTimeout);
54Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.CloseTimeout);
55Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.OpenTimeout);
56Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(10), binding.ReceiveTimeout);
57Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.SendTimeout);
78Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.CloseTimeout);
79Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.OpenTimeout);
80Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(10), binding.ReceiveTimeout);
81Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.SendTimeout);
222public static void CloseTimeout_Property_Sets(TimeSpan timeSpan)
226Assert.Equal<TimeSpan>(timeSpan, binding.CloseTimeout);
231public static void CloseTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
239public static void OpenTimeout_Property_Sets(TimeSpan timeSpan)
243Assert.Equal<TimeSpan>(timeSpan, binding.OpenTimeout);
248public static void OpenTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
256public static void SendTimeout_Property_Sets(TimeSpan timeSpan)
260Assert.Equal<TimeSpan>(timeSpan, binding.SendTimeout);
265public static void SendTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
273public static void ReceiveTimeout_Property_Sets(TimeSpan timeSpan)
277Assert.Equal<TimeSpan>(timeSpan, binding.ReceiveTimeout);
282public static void ReceiveTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
ServiceModel\BasicHttpsBindingTest.cs (28)
27Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.CloseTimeout);
28Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.OpenTimeout);
29Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(10), binding.ReceiveTimeout);
30Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.SendTimeout);
52Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.CloseTimeout);
53Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.OpenTimeout);
54Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(10), binding.ReceiveTimeout);
55Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.SendTimeout);
212public static void CloseTimeout_Property_Sets(TimeSpan timeSpan)
216Assert.Equal<TimeSpan>(timeSpan, binding.CloseTimeout);
221public static void CloseTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
229public static void OpenTimeout_Property_Sets(TimeSpan timeSpan)
233Assert.Equal<TimeSpan>(timeSpan, binding.OpenTimeout);
238public static void OpenTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
246public static void SendTimeout_Property_Sets(TimeSpan timeSpan)
250Assert.Equal<TimeSpan>(timeSpan, binding.SendTimeout);
255public static void SendTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
263public static void ReceiveTimeout_Property_Sets(TimeSpan timeSpan)
267Assert.Equal<TimeSpan>(timeSpan, binding.ReceiveTimeout);
272public static void ReceiveTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
System.ServiceModel.NetFramingBase (211)
System\ServiceModel\Channels\Connection.cs (18)
17ValueTask<int> ReadAsync(Memory<byte> buffer, TimeSpan timeout);
18ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, bool immediate, TimeSpan timeout);
20ValueTask CloseAsync(TimeSpan timeout);
25ValueTask<IConnection> ConnectAsync(Uri uri, TimeSpan timeout);
38public virtual ValueTask<int> ReadAsync(Memory<byte> buffer, TimeSpan timeout) => Connection.ReadAsync(buffer, timeout);
39public virtual ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, bool immediate, TimeSpan timeout) => Connection.WriteAsync(buffer, immediate, timeout);
40public virtual ValueTask CloseAsync(TimeSpan timeout) => Connection.CloseAsync(timeout);
68public override ValueTask<int> ReadAsync(Memory<byte> buffer, TimeSpan timeout)
118public TimeSpan CloseTimeout { get; set; }
263protected int Read(byte[] buffer, int offset, int count, TimeSpan timeout)
292public async ValueTask<int> ReadAsync(Memory<byte> buffer, TimeSpan timeout)
305public async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, bool immediate, TimeSpan timeout)
320public async ValueTask CloseAsync(TimeSpan timeout)
364public void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
378public void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager)
384private void SetReadTimeout(TimeSpan timeout)
394private void SetWriteTimeout(TimeSpan timeout)
404public int Read(byte[] buffer, int offset, int size, TimeSpan timeout)
System\ServiceModel\Channels\ConnectionPool.cs (16)
43protected abstract ValueTask CloseItemAsync(TItem item, TimeSpan timeout);
52public async ValueTask<bool> CloseAsync(TimeSpan timeout)
117private EndpointConnectionPool GetEndpointPool(TKey key, TimeSpan timeout)
170private async ValueTask OnCloseAsync(TimeSpan timeout)
194public void AddConnection(TKey key, TItem connection, TimeSpan timeout)
201public TItem TakeConnection(EndpointAddress address, Uri via, TimeSpan timeout, out TKey key)
209public void ReturnConnection(TKey key, TItem connection, bool connectionIsStillGood, TimeSpan timeout)
288protected virtual ValueTask CloseItemAsync(TItem item, TimeSpan timeout)
315public async ValueTask CloseAsync(TimeSpan timeout)
389public void AddConnection(TItem connection, TimeSpan timeout)
422public TItem TakeConnection(TimeSpan timeout)
478public void ReturnConnection(TItem connection, bool connectionIsStillGood, TimeSpan timeout)
516public void CloseIdleConnection(TItem connection, TimeSpan timeout)
609private readonly TimeSpan _maxOutputDelay;
614public ConnectionPool(IConnectionOrientedTransportChannelFactorySettings settings, TimeSpan leaseTimeout)
635protected override async ValueTask CloseItemAsync(IConnection item, TimeSpan timeout)
System\ServiceModel\Channels\FramingChannels.cs (14)
42protected override ValueTask CloseOutputSessionCoreAsync(TimeSpan timeout)
47protected override void CompleteClose(TimeSpan timeout)
52protected override async ValueTask OnSendCoreAsync(Message message, TimeSpan timeout)
65protected override ValueTask CloseOutputAsync(TimeSpan timeout)
70protected override ValueTask StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout)
75protected override ValueTask StartWritingStreamedMessage(Message message, TimeSpan timeout)
187protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
209private async Task<IConnection> SendPreambleAsync(IConnection connection, Memory<byte> preamble, TimeSpan timeout)
268internal protected override async Task OnOpenAsync(TimeSpan timeout)
299protected override void OnOpen(TimeSpan timeout)
304protected override void ReturnConnectionIfNecessary(bool abort, TimeSpan timeout)
358protected override TimeoutException CreateNewConnectionTimeoutException(TimeSpan timeout, TimeoutException innerException)
375Uri via, string contentType, TimeSpan timeout)
419ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeSpan timeout)
System\ServiceModel\Channels\TransportDuplexSessionChannel.cs (28)
65public Message Receive(TimeSpan timeout)
75public async Task<Message> ReceiveAsync(TimeSpan timeout)
111public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
121public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
145public async Task<(bool, Message)> TryReceiveAsync(TimeSpan timeout)
163public bool TryReceive(TimeSpan timeout, out Message message)
181public async Task<bool> WaitForMessageAsync(TimeSpan timeout)
205public bool WaitForMessage(TimeSpan timeout)
210public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
231protected abstract ValueTask CloseOutputSessionCoreAsync(TimeSpan timeout);
233protected async Task CloseOutputSessionAsync(TimeSpan timeout)
289protected abstract void ReturnConnectionIfNecessary(bool abort, TimeSpan timeout);
293ReturnConnectionIfNecessary(true, TimeSpan.Zero);
299ReturnConnectionIfNecessary(true, TimeSpan.Zero);
302protected internal override async Task OnCloseAsync(TimeSpan timeout)
317protected override void OnClose(TimeSpan timeout)
322protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
382protected abstract ValueTask StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout);
384protected abstract ValueTask CloseOutputAsync(TimeSpan timeout);
388protected abstract ValueTask OnSendCoreAsync(Message message, TimeSpan timeout);
390protected abstract ValueTask StartWritingStreamedMessage(Message message, TimeSpan timeout);
392protected override async Task OnSendAsync(Message message, TimeSpan timeout)
468protected override void OnSend(Message message, TimeSpan timeout)
519protected abstract void CompleteClose(TimeSpan timeout);
530private async Task EnsureInputClosedAsync(TimeSpan timeout)
624public IAsyncResult BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state)
639public void CloseOutputSession(TimeSpan timeout)
649public Task CloseOutputSessionAsync(TimeSpan timeout)
System.ServiceModel.NetNamedPipe (56)
System.ServiceModel.NetTcp.Tests (6)
System.ServiceModel.Primitives (114)
netstandard.cs (114)
198public System.IdentityModel.Tokens.SecurityToken GetToken(System.TimeSpan timeout) { return default; }
199public System.IAsyncResult BeginGetToken(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
201public System.IdentityModel.Tokens.SecurityToken RenewToken(System.TimeSpan timeout, System.IdentityModel.Tokens.SecurityToken tokenToBeRenewed) { return default; }
202public System.IAsyncResult BeginRenewToken(System.TimeSpan timeout, System.IdentityModel.Tokens.SecurityToken tokenToBeRenewed, System.AsyncCallback callback, object state) { return default; }
204public void CancelToken(System.TimeSpan timeout, System.IdentityModel.Tokens.SecurityToken token) { }
205public System.IAsyncResult BeginCancelToken(System.TimeSpan timeout, System.IdentityModel.Tokens.SecurityToken token, System.AsyncCallback callback, object state) { return default; }
207protected abstract System.IdentityModel.Tokens.SecurityToken GetTokenCore(System.TimeSpan timeout);
208protected virtual System.IdentityModel.Tokens.SecurityToken RenewTokenCore(System.TimeSpan timeout, System.IdentityModel.Tokens.SecurityToken tokenToBeRenewed) { return default; }
209protected virtual void CancelTokenCore(System.TimeSpan timeout, System.IdentityModel.Tokens.SecurityToken token) { }
210protected virtual System.IAsyncResult BeginGetTokenCore(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
212protected virtual System.IAsyncResult BeginRenewTokenCore(System.TimeSpan timeout, System.IdentityModel.Tokens.SecurityToken tokenToBeRenewed, System.AsyncCallback callback, object state) { return default; }
214protected virtual System.IAsyncResult BeginCancelTokenCore(System.TimeSpan timeout, System.IdentityModel.Tokens.SecurityToken token, System.AsyncCallback callback, object state) { return default; }
434protected override System.TimeSpan DefaultCloseTimeout { get { return default; } }
435protected override System.TimeSpan DefaultOpenTimeout { get { return default; } }
444protected override System.IAsyncResult OnBeginClose(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
445protected override System.IAsyncResult OnBeginOpen(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
446protected override void OnClose(System.TimeSpan timeout) { }
449protected override void OnOpen(System.TimeSpan timeout) { }
496System.IAsyncResult System.ServiceModel.ICommunicationObject.BeginClose(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
498System.IAsyncResult System.ServiceModel.ICommunicationObject.BeginOpen(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
500void System.ServiceModel.ICommunicationObject.Close(System.TimeSpan timeout) { }
504void System.ServiceModel.ICommunicationObject.Open(System.TimeSpan timeout) { }
521System.TimeSpan System.ServiceModel.IContextChannel.OperationTimeout { get { return default; } set { } }
537System.IAsyncResult System.ServiceModel.Channels.IOutputChannel.BeginSend(System.ServiceModel.Channels.Message message, System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
540void System.ServiceModel.Channels.IOutputChannel.Send(System.ServiceModel.Channels.Message message, System.TimeSpan timeout) { }
542System.IAsyncResult System.ServiceModel.Channels.IRequestChannel.BeginRequest(System.ServiceModel.Channels.Message message, System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
545System.ServiceModel.Channels.Message System.ServiceModel.Channels.IRequestChannel.Request(System.ServiceModel.Channels.Message message, System.TimeSpan timeout) { return default; }
554System.IAsyncResult System.ServiceModel.ICommunicationObject.BeginClose(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
556System.IAsyncResult System.ServiceModel.ICommunicationObject.BeginOpen(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
558void System.ServiceModel.ICommunicationObject.Close(System.TimeSpan timeout) { }
562void System.ServiceModel.ICommunicationObject.Open(System.TimeSpan timeout) { }
805System.IAsyncResult BeginClose(System.TimeSpan timeout, System.AsyncCallback callback, object state);
807System.IAsyncResult BeginOpen(System.TimeSpan timeout, System.AsyncCallback callback, object state);
809void Close(System.TimeSpan timeout);
813void Open(System.TimeSpan timeout);
820System.TimeSpan OperationTimeout { get; set; }
827System.TimeSpan CloseTimeout { get; }
828System.TimeSpan OpenTimeout { get; }
829System.TimeSpan ReceiveTimeout { get; }
830System.TimeSpan SendTimeout { get; }
1008public System.TimeSpan InactivityTimeout { get; set; }
1078protected override System.TimeSpan DefaultCloseTimeout { get { return default(System.TimeSpan); } }
1079protected override System.TimeSpan DefaultOpenTimeout { get { return default(System.TimeSpan); } }
1084protected override System.IAsyncResult OnBeginClose(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default(System.IAsyncResult); }
1085protected override System.IAsyncResult OnBeginOpen(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default(System.IAsyncResult); }
1086protected override void OnClose(System.TimeSpan timeout) { }
1091protected override void OnOpen(System.TimeSpan timeout) { }
1126public static System.TimeSpan SpnLookupTime { get { return default; } set { } }
1235[System.ComponentModel.DefaultValueAttribute(typeof(System.TimeSpan), "00:01:00")]
1236public System.TimeSpan CloseTimeout { get { return default; } set { } }
1240[System.ComponentModel.DefaultValueAttribute(typeof(System.TimeSpan), "00:01:00")]
1241public System.TimeSpan OpenTimeout { get { return default; } set { } }
1242[System.ComponentModel.DefaultValueAttribute(typeof(System.TimeSpan), "00:10:00")]
1243public System.TimeSpan ReceiveTimeout { get { return default; } set { } }
1245[System.ComponentModel.DefaultValueAttribute(typeof(System.TimeSpan), "00:01:00")]
1246public System.TimeSpan SendTimeout { get { return default; } set { } }
1314protected override System.TimeSpan DefaultCloseTimeout { get { return default; } }
1315protected override System.TimeSpan DefaultOpenTimeout { get { return default; } }
1316protected System.TimeSpan DefaultReceiveTimeout { get { return default; } }
1317protected System.TimeSpan DefaultSendTimeout { get { return default; } }
1319System.TimeSpan System.ServiceModel.IDefaultCommunicationTimeouts.CloseTimeout { get { return default; } }
1320System.TimeSpan System.ServiceModel.IDefaultCommunicationTimeouts.OpenTimeout { get { return default; } }
1321System.TimeSpan System.ServiceModel.IDefaultCommunicationTimeouts.ReceiveTimeout { get { return default; } }
1322System.TimeSpan System.ServiceModel.IDefaultCommunicationTimeouts.SendTimeout { get { return default; } }
1330protected override System.TimeSpan DefaultCloseTimeout { get { return default; } }
1331protected override System.TimeSpan DefaultOpenTimeout { get { return default; } }
1332protected override System.TimeSpan DefaultReceiveTimeout { get { return default; } }
1333protected override System.TimeSpan DefaultSendTimeout { get { return default; } }
1336protected override System.IAsyncResult OnBeginClose(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
1337protected override void OnClose(System.TimeSpan timeout) { }
1347protected override System.IAsyncResult OnBeginClose(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
1348protected override void OnClose(System.TimeSpan timeout) { }
1356protected abstract System.TimeSpan DefaultReceiveTimeout { get; }
1357protected abstract System.TimeSpan DefaultSendTimeout { get; }
1358System.TimeSpan System.ServiceModel.IDefaultCommunicationTimeouts.CloseTimeout { get { return default; } }
1359System.TimeSpan System.ServiceModel.IDefaultCommunicationTimeouts.OpenTimeout { get { return default; } }
1360System.TimeSpan System.ServiceModel.IDefaultCommunicationTimeouts.ReceiveTimeout { get { return default; } }
1361System.TimeSpan System.ServiceModel.IDefaultCommunicationTimeouts.SendTimeout { get { return default; } }
1378protected abstract System.TimeSpan DefaultCloseTimeout { get; }
1379protected abstract System.TimeSpan DefaultOpenTimeout { get; }
1390public System.IAsyncResult BeginClose(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
1392public System.IAsyncResult BeginOpen(System.TimeSpan timeout, System.AsyncCallback callback, object state) { return default; }
1394public void Close(System.TimeSpan timeout) { }
1400protected abstract System.IAsyncResult OnBeginClose(System.TimeSpan timeout, System.AsyncCallback callback, object state);
1401protected abstract System.IAsyncResult OnBeginOpen(System.TimeSpan timeout, System.AsyncCallback callback, object state);
1402protected abstract void OnClose(System.TimeSpan timeout);
1408protected abstract void OnOpen(System.TimeSpan timeout);
1412public void Open(System.TimeSpan timeout) { }
1463System.IAsyncResult BeginCloseOutputSession(System.TimeSpan timeout, System.AsyncCallback callback, object state);
1465void CloseOutputSession(System.TimeSpan timeout);
1475System.IAsyncResult BeginReceive(System.TimeSpan timeout, System.AsyncCallback callback, object state);
1476System.IAsyncResult BeginTryReceive(System.TimeSpan timeout, System.AsyncCallback callback, object state);
1477System.IAsyncResult BeginWaitForMessage(System.TimeSpan timeout, System.AsyncCallback callback, object state);
1482System.ServiceModel.Channels.Message Receive(System.TimeSpan timeout);
1483bool TryReceive(System.TimeSpan timeout, out System.ServiceModel.Channels.Message message);
1484bool WaitForMessage(System.TimeSpan timeout);
1501System.IAsyncResult BeginSend(System.ServiceModel.Channels.Message message, System.TimeSpan timeout, System.AsyncCallback callback, object state);
1504void Send(System.ServiceModel.Channels.Message message, System.TimeSpan timeout);
1517System.IAsyncResult BeginRequest(System.ServiceModel.Channels.Message message, System.TimeSpan timeout, System.AsyncCallback callback, object state);
1520System.ServiceModel.Channels.Message Request(System.ServiceModel.Channels.Message message, System.TimeSpan timeout);
1799public System.TimeSpan AcknowledgementInterval { get; set; }
1801public System.TimeSpan InactivityTimeout { get; set; }
1818public abstract System.IAsyncResult BeginReply(System.ServiceModel.Channels.Message message, System.TimeSpan timeout, System.AsyncCallback callback, object state);
1820public abstract void Close(System.TimeSpan timeout);
1824public abstract void Reply(System.ServiceModel.Channels.Message message, System.TimeSpan timeout);
1873public System.TimeSpan MaxClockSkew { get { return default; } set { } }
1875public System.TimeSpan ReplayWindow { get { return default; } set { } }
1876public System.TimeSpan TimestampValidityDuration { get { return default; } set { } }
2328TimeSpan DefaultOpenTimeout { get; }
2329TimeSpan DefaultCloseTimeout { get; }
2331Threading.Tasks.Task OnCloseAsync(TimeSpan timeout);
2335Threading.Tasks.Task OnOpenAsync(TimeSpan timeout);
System.ServiceModel.Primitives.Tests (88)
IdentityModel\SecurityTokenProviderTest.cs (42)
23var token = provider.GetToken(TimeSpan.Zero);
26token = provider.RenewToken(TimeSpan.Zero, token);
29provider.CancelToken(TimeSpan.Zero, token);
32var iar = provider.BeginGetToken(TimeSpan.Zero, null, null);
36iar = provider.BeginRenewToken(TimeSpan.Zero, token, null, null);
40iar = provider.BeginCancelToken(TimeSpan.Zero, token, null, null);
44token = provider.GetTokenAsync(TimeSpan.Zero).Result;
47token = provider.RenewTokenAsync(TimeSpan.Zero, token).Result;
50provider.CancelTokenAsync(TimeSpan.Zero, token).Wait();
59var token = provider.GetToken(TimeSpan.Zero);
62token = provider.RenewToken(TimeSpan.Zero, token);
65provider.CancelToken(TimeSpan.Zero, token);
68var iar = provider.BeginGetToken(TimeSpan.Zero, null, null);
72iar = provider.BeginRenewToken(TimeSpan.Zero, token, null, null);
76iar = provider.BeginCancelToken(TimeSpan.Zero, token, null, null);
80token = provider.GetTokenAsync(TimeSpan.Zero).Result;
83token = provider.RenewTokenAsync(TimeSpan.Zero, token).Result;
86provider.CancelTokenAsync(TimeSpan.Zero, token).Wait();
97var token = provider.GetToken(TimeSpan.Zero);
100token = provider.RenewToken(TimeSpan.Zero, token);
103provider.CancelToken(TimeSpan.Zero, token);
106var iar = provider.BeginGetToken(TimeSpan.Zero, null, null);
110iar = provider.BeginRenewToken(TimeSpan.Zero, token, null, null);
114iar = provider.BeginCancelToken(TimeSpan.Zero, token, null, null);
118token = provider.GetTokenAsync(TimeSpan.Zero).Result;
121token = provider.RenewTokenAsync(TimeSpan.Zero, token).Result;
124provider.CancelTokenAsync(TimeSpan.Zero, token).Wait();
133protected override SecurityToken GetTokenCore(TimeSpan timeout)
138protected override SecurityToken RenewTokenCore(TimeSpan timeout, SecurityToken tokenToBeRenewed)
144protected override void CancelTokenCore(TimeSpan timeout, SecurityToken token)
155protected override SecurityToken GetTokenCore(TimeSpan timeout)
160protected override IAsyncResult BeginGetTokenCore(TimeSpan timeout, AsyncCallback callback, object state)
172protected override SecurityToken RenewTokenCore(TimeSpan timeout, SecurityToken tokenToBeRenewed)
178protected override IAsyncResult BeginRenewTokenCore(TimeSpan timeout, SecurityToken tokenToBeRenewed, AsyncCallback callback, object state)
191protected override void CancelTokenCore(TimeSpan timeout, SecurityToken token)
197protected override IAsyncResult BeginCancelTokenCore(TimeSpan timeout, SecurityToken token, AsyncCallback callback, object state)
216protected override SecurityToken GetTokenCore(TimeSpan timeout)
221protected override Task<SecurityToken> GetTokenCoreAsync(TimeSpan timeout)
226protected override SecurityToken RenewTokenCore(TimeSpan timeout, SecurityToken tokenToBeRenewed)
232protected override Task<SecurityToken> RenewTokenCoreAsync(TimeSpan timeout, SecurityToken tokenToBeRenewed)
238protected override void CancelTokenCore(TimeSpan timeout, SecurityToken token)
244protected override Task CancelTokenCoreAsync(TimeSpan timeout, SecurityToken token)
ServiceModel\ThrowingOnCloseBindingElement.cs (17)
72protected override void OnOpen(TimeSpan timeout)
77protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
93protected override void OnClose(TimeSpan timeout)
104protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
114private async Task OnCloseAsyncImpl(TimeSpan timeout)
195public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state) => InnerChannel.BeginSend(message, timeout, callback, state);
198public void Send(Message message, TimeSpan timeout) => InnerChannel.Send(message, timeout);
212public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state) => InnerChannel.BeginRequest(message, timeout, callback, state);
215public Message Request(Message message, TimeSpan timeout) => InnerChannel.Request(message, timeout);
254public Message Receive(TimeSpan timeout) => InnerChannel.Receive(timeout);
256public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state) => InnerChannel.BeginReceive(timeout, callback, state);
258public bool TryReceive(TimeSpan timeout, out Message message) => InnerChannel.TryReceive(timeout, out message);
259public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state) => InnerChannel.BeginTryReceive(timeout, callback, state);
261public bool WaitForMessage(TimeSpan timeout) => InnerChannel.WaitForMessage(timeout);
262public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state) => InnerChannel.BeginWaitForMessage(timeout, callback, state);
276public void Send(Message message, TimeSpan timeout) => InnerChannel.Send(message, timeout);
278public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state) => InnerChannel.BeginSend(message, callback, state);
System.ServiceModel.Syndication (4)
System.ServiceModel.UnixDomainSocket (69)
System\ServiceModel\Channels\SocketConnection.cs (31)
20private TimeSpan _asyncSendTimeout;
21private TimeSpan _readFinTimeout;
22private TimeSpan _asyncReceiveTimeout;
156public ValueTask<int> ReadAsync(Memory<byte> buffer, TimeSpan timeout)
167private async ValueTask<int> ReadCoreAsync(Memory<byte> buffer, TimeSpan timeout, bool closing)
239public async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, bool immediate, TimeSpan timeout)
312public async ValueTask CloseAsync(TimeSpan timeout)
373private void Shutdown(TimeSpan timeout)
392ConvertSendException(socketException, TimeSpan.MaxValue, _asyncSendTimeout));
493private void SetReadTimeout(TimeSpan timeout, bool closing)
495if (timeout <= TimeSpan.Zero)
502if (timeout == TimeSpan.MaxValue)
544private void SetWriteTimeout(TimeSpan timeout)
546if (timeout <= TimeSpan.Zero)
553if (timeout == TimeSpan.MaxValue)
587private bool ShouldUpdateTimeout(DateTime oldTimeoutDeadline, TimeSpan newTimeout)
589var oldTimeout = oldTimeoutDeadline - DateTime.UtcNow;
590if (oldTimeout < TimeSpan.Zero) // Expired already
633private Exception ConvertSendException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout)
639private Exception ConvertReceiveException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout)
645private static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException,
647SocketConnection socketConnection, TimeSpan remainingTime)
661remainingTime <= TimeSpan.Zero)
790public static Exception ConvertConnectException(SocketException socketException, Uri remoteUri, TimeSpan timeSpent, Exception innerException)
805if (timeSpent == TimeSpan.MaxValue)
826if (timeSpent == TimeSpan.MaxValue)
837private static TimeoutException CreateTimeoutException(Uri uri, TimeSpan timeout, SocketException innerException)
842public async ValueTask<IConnection> ConnectAsync(Uri uri, TimeSpan timeout)
848if (timeoutHelper.RemainingTime() == TimeSpan.Zero)
System.ServiceProcess.ServiceController (2)
System.Speech (29)
System.Text.Json (19)
System\Text\Json\Serialization\Converters\Value\TimeSpanConverter.cs (7)
11internal sealed class TimeSpanConverter : JsonPrimitiveConverter<TimeSpan>
17public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
27internal override TimeSpan ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
33private static TimeSpan ReadCore(ref Utf8JsonReader reader)
62bool result = Utf8Parser.TryParse(source, out TimeSpan tmpValue, out int bytesConsumed, 'c');
77public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options)
87internal override void WriteAsPropertyNameCore(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options, bool isWritingExtensionDataProperty)
System.Text.Json.SourceGeneration (1)
System.Text.RegularExpressions (49)
System\Text\RegularExpressions\Regex.EnumerateSplits.cs (7)
70/// The behavior of <see cref="EnumerateSplits(ReadOnlySpan{char}, string, RegexOptions, TimeSpan)"/> is similar to the behavior of <see cref="Split(string, string, RegexOptions, TimeSpan)"/>, producing the splits
72/// <see cref="Split(string, string, RegexOptions, TimeSpan)"/> will include the contents of capture groups in the resulting splits, while <see cref="EnumerateSplits(ReadOnlySpan{char}, string, RegexOptions, TimeSpan)"/> will not.
73/// And if <see cref="RegexOptions.RightToLeft"/> is specified, <see cref="Split(string, string, RegexOptions, TimeSpan)"/> will reverse the order of the resulting splits to be left-to-right, whereas
74/// <see cref="EnumerateSplits(ReadOnlySpan{char}, string, RegexOptions, TimeSpan)"/> will yield the splits in the order they're found right-to-left.
90public static ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char> input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options, TimeSpan matchTimeout) =>
System\Text\RegularExpressions\Regex.Match.cs (4)
50public static bool IsMatch(string input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options, TimeSpan matchTimeout) =>
66public static bool IsMatch(ReadOnlySpan<char> input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options, TimeSpan matchTimeout) =>
131public static Match Match(string input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options, TimeSpan matchTimeout) =>
187public static MatchCollection Matches(string input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options, TimeSpan matchTimeout) =>
System\Text\RegularExpressions\Regex.Replace.cs (2)
30public static string Replace(string input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, string replacement, RegexOptions options, TimeSpan matchTimeout) =>
100public static string Replace(string input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, MatchEvaluator evaluator, RegexOptions options, TimeSpan matchTimeout) =>
System.Threading (20)
System.Threading.RateLimiting (47)
System.Threading.Tasks.Dataflow (12)
Base\DataflowBlock.cs (10)
811/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
822this ISourceBlock<TOutput> source, TimeSpan timeout)
831/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
843this ISourceBlock<TOutput> source, TimeSpan timeout, CancellationToken cancellationToken)
890/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
902this ISourceBlock<TOutput> source, TimeSpan timeout)
911/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
925this ISourceBlock<TOutput> source, TimeSpan timeout, CancellationToken cancellationToken)
968/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
972this ISourceBlock<TOutput> source, bool attemptTryReceive, TimeSpan timeout, CancellationToken cancellationToken)
System.Transactions.Local (48)
System\Transactions\TransactionScope.cs (20)
106public TransactionScope(TransactionScopeOption scopeOption, TimeSpan scopeTimeout)
113TimeSpan scopeTimeout,
124TimeSpan txTimeout = TransactionManager.ValidateTimeout(scopeTimeout);
134if ((null != _expectedCurrent) && (null == _committableTransaction) && (TimeSpan.Zero != scopeTimeout))
141TimeSpan.Zero);
196TimeSpan scopeTimeout = transactionOptions.Timeout;
220if ((null != _expectedCurrent) && (null == _committableTransaction) && (TimeSpan.Zero != scopeTimeout))
227TimeSpan.Zero);
276TimeSpan scopeTimeout = transactionOptions.Timeout;
302if ((null != _expectedCurrent) && (null == _committableTransaction) && (TimeSpan.Zero != scopeTimeout))
309TimeSpan.Zero);
366TimeSpan.Zero,
375public TransactionScope(Transaction transactionToUse, TimeSpan scopeTimeout)
382TimeSpan scopeTimeout,
406TimeSpan scopeTimeout,
466TimeSpan scopeTimeout,
475if (TimeSpan.Zero != scopeTimeout)
481TimeSpan.Zero
1123private static void ValidateScopeTimeout(string? paramName, TimeSpan scopeTimeout)
1125ArgumentOutOfRangeException.ThrowIfLessThan(scopeTimeout, TimeSpan.Zero, paramName);
System.Windows.Controls.Ribbon (7)
System.Windows.Forms.Tests (4)
System.Windows.Forms.UI.IntegrationTests (19)
System.Windows.Presentation (4)
System.Xaml (6)
System.Xaml.Tests (9)
System\Xaml\Replacements\DateTimeOffsetConverter2Tests.cs (5)
31DateTimeOffset dateTimeOffset = new DateTimeOffset(2018, 12, 9, 1, 2, 3, 4, TimeSpan.FromMinutes(10));
71yield return new object?[] { new DateTimeOffset(2018, 12, 9, 1, 2, 3, 4, TimeSpan.FromMinutes(10)), new CultureInfo("en-US") };
86var dateTimeOffset = new DateTimeOffset(2018, 12, 9, 1, 2, 3, 4, TimeSpan.FromMinutes(10));
91Assert.Equal(new Type[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(TimeSpan) }, parameters.Select(p => p.ParameterType));
92Assert.Equal(new object[] { 2018, 12, 9, 1, 2, 3, 4, TimeSpan.FromMinutes(10) }, descriptor.Arguments);
Templates.Blazor.Tests (18)
Templates.Blazor.WebAssembly.Auth.Tests (34)
src\Shared\E2ETesting\WaitAssert.cs (11)
23public static TimeSpan DefaultTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultWaitTimeoutInSeconds);
24public static TimeSpan FailureTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultAfterFailureWaitTimeoutInSeconds);
35public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout)
38public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout, string message)
64public static TElement Exists<TElement>(this IWebDriver driver, Func<TElement> actual, TimeSpan timeout)
67public static void DoesNotExist(this IWebDriver driver, By finder, TimeSpan timeout = default)
74public static IWebElement Exists(this IWebDriver driver, By finder, TimeSpan timeout)
89private static void WaitAssertCore(IWebDriver driver, Action assertion, TimeSpan timeout = default)
94private static TResult WaitAssertCore<TResult>(IWebDriver driver, Func<TResult> assertion, TimeSpan timeout = default)
Templates.Blazor.WebAssembly.Tests (34)
src\Shared\E2ETesting\WaitAssert.cs (11)
23public static TimeSpan DefaultTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultWaitTimeoutInSeconds);
24public static TimeSpan FailureTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultAfterFailureWaitTimeoutInSeconds);
35public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout)
38public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout, string message)
64public static TElement Exists<TElement>(this IWebDriver driver, Func<TElement> actual, TimeSpan timeout)
67public static void DoesNotExist(this IWebDriver driver, By finder, TimeSpan timeout = default)
74public static IWebElement Exists(this IWebDriver driver, By finder, TimeSpan timeout)
89private static void WaitAssertCore(IWebDriver driver, Action assertion, TimeSpan timeout = default)
94private static TResult WaitAssertCore<TResult>(IWebDriver driver, Func<TResult> assertion, TimeSpan timeout = default)
Templates.Mvc.Tests (34)
src\Shared\E2ETesting\WaitAssert.cs (11)
23public static TimeSpan DefaultTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultWaitTimeoutInSeconds);
24public static TimeSpan FailureTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultAfterFailureWaitTimeoutInSeconds);
35public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout)
38public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout, string message)
64public static TElement Exists<TElement>(this IWebDriver driver, Func<TElement> actual, TimeSpan timeout)
67public static void DoesNotExist(this IWebDriver driver, By finder, TimeSpan timeout = default)
74public static IWebElement Exists(this IWebDriver driver, By finder, TimeSpan timeout)
89private static void WaitAssertCore(IWebDriver driver, Action assertion, TimeSpan timeout = default)
94private static TResult WaitAssertCore<TResult>(IWebDriver driver, Func<TResult> assertion, TimeSpan timeout = default)
Templates.Tests (34)
src\Shared\E2ETesting\WaitAssert.cs (11)
23public static TimeSpan DefaultTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultWaitTimeoutInSeconds);
24public static TimeSpan FailureTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultAfterFailureWaitTimeoutInSeconds);
35public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout)
38public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout, string message)
64public static TElement Exists<TElement>(this IWebDriver driver, Func<TElement> actual, TimeSpan timeout)
67public static void DoesNotExist(this IWebDriver driver, By finder, TimeSpan timeout = default)
74public static IWebElement Exists(this IWebDriver driver, By finder, TimeSpan timeout)
89private static void WaitAssertCore(IWebDriver driver, Action assertion, TimeSpan timeout = default)
94private static TResult WaitAssertCore<TResult>(IWebDriver driver, Func<TResult> assertion, TimeSpan timeout = default)
Test.Utilities (10)
TestProject.IntegrationServiceA (2)
Text.Analyzers (10)
UnitTests.Common (101)
IMockCommunicationObject.cs (10)
15Func<TimeSpan> DefaultCloseTimeoutOverride { get; set; }
16Func<TimeSpan> DefaultOpenTimeoutOverride { get; set; }
18Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginCloseOverride { get; set; }
19Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginOpenOverride { get; set; }
20Action<TimeSpan> OnOpenOverride { get; set; }
21Action<TimeSpan> OnCloseOverride { get; set; }
34void DefaultOnOpen(TimeSpan timeout);
37void DefaultOnClose(TimeSpan timeout);
40IAsyncResult DefaultOnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state);
43IAsyncResult DefaultOnBeginClose(TimeSpan timeout, AsyncCallback callback, object state);
MockChannelBase.cs (20)
55public Func<TimeSpan> DefaultCloseTimeoutOverride { get; set; }
56public Func<TimeSpan> DefaultOpenTimeoutOverride { get; set; }
58public Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginCloseOverride { get; set; }
59public Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginOpenOverride { get; set; }
60public Action<TimeSpan> OnOpenOverride { get; set; }
61public Action<TimeSpan> OnCloseOverride { get; set; }
82protected override TimeSpan DefaultCloseTimeout
90public TimeSpan DefaultDefaultCloseTimeout()
92return TimeSpan.FromSeconds(30);
95protected override TimeSpan DefaultOpenTimeout
103public TimeSpan DefaultDefaultOpenTimeout()
105return TimeSpan.FromSeconds(30);
118protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
123public IAsyncResult DefaultOnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
138protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
143public IAsyncResult DefaultOnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
158protected override void OnClose(TimeSpan timeout)
163public void DefaultOnClose(TimeSpan timeout)
190protected override void OnOpen(TimeSpan timeout)
195public void DefaultOnOpen(TimeSpan timeout)
MockChannelFactory.cs (20)
54public Func<TimeSpan> DefaultCloseTimeoutOverride { get; set; }
55public Func<TimeSpan> DefaultOpenTimeoutOverride { get; set; }
57public Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginCloseOverride { get; set; }
58public Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginOpenOverride { get; set; }
59public Action<TimeSpan> OnOpenOverride { get; set; }
60public Action<TimeSpan> OnCloseOverride { get; set; }
84protected override TimeSpan DefaultCloseTimeout
92public TimeSpan DefaultDefaultCloseTimeout()
94return TimeSpan.FromSeconds(30);
97protected override TimeSpan DefaultOpenTimeout
105public TimeSpan DefaultDefaultOpenTimeout()
107return TimeSpan.FromSeconds(30);
120protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
125public IAsyncResult DefaultOnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
139protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
144public IAsyncResult DefaultOnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
158protected override void OnClose(TimeSpan timeout)
163public void DefaultOnClose(TimeSpan timeout)
188protected override void OnOpen(TimeSpan timeout)
193public void DefaultOnOpen(TimeSpan timeout)
MockCommunicationObject.cs (28)
50public Func<TimeSpan> DefaultCloseTimeoutOverride { get; set; }
51public Func<TimeSpan> DefaultOpenTimeoutOverride { get; set; }
53public Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginCloseOverride { get; set; }
54public Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginOpenOverride { get; set; }
55public Action<TimeSpan> OnOpenOverride { get; set; }
56public Action<TimeSpan> OnCloseOverride { get; set; }
67protected override TimeSpan DefaultCloseTimeout
75public TimeSpan DefaultDefaultCloseTimeout()
77return TimeSpan.FromSeconds(30);
80protected override TimeSpan DefaultOpenTimeout
88public TimeSpan DefaultDefaultOpenTimeout()
90return TimeSpan.FromSeconds(30);
103protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
108public IAsyncResult DefaultOnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
123protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
129public IAsyncResult DefaultOnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
144protected override void OnClose(TimeSpan timeout)
149public void DefaultOnClose(TimeSpan timeout)
176protected override void OnOpen(TimeSpan timeout)
181public void DefaultOnOpen(TimeSpan timeout)
247mco.OnOpenOverride = (TimeSpan t) =>
253mco.OnBeginOpenOverride = (TimeSpan t, AsyncCallback c, object s) =>
276mco.OnCloseOverride = (TimeSpan t) =>
282mco.OnBeginCloseOverride = (TimeSpan t, AsyncCallback c, object s) =>
330mco.OnOpenOverride = (TimeSpan t) =>
337mco.OnBeginOpenOverride = (TimeSpan t, AsyncCallback c, object s) =>
359mco.OnCloseOverride = (TimeSpan t) =>
366mco.OnBeginCloseOverride = (TimeSpan t, AsyncCallback c, object s) =>
MockRequestChannel.cs (6)
18public Func<Message, TimeSpan, Message> RequestOverride { get; set; }
19public Func<Message,TimeSpan,AsyncCallback,object, IAsyncResult> BeginRequestOverride { get; set; }
32public Message Request(Message message, TimeSpan timeout)
37public Message DefaultRequest(Message message, TimeSpan timeout)
49public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
59public IAsyncResult DefaultBeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
VBCSCompiler (19)
VBCSCompiler.UnitTests (17)
Wasm.Performance.ConsoleHost (1)
Wasm.Performance.Driver (5)
WindowsBase.Tests (30)
System\Windows\Threading\DispatcherTimerTests.cs (29)
15Assert.Equal(TimeSpan.Zero, timer.Interval);
35Assert.Equal(TimeSpan.Zero, timer.Interval);
55Assert.Equal(TimeSpan.Zero, timer.Interval);
62yield return new object?[] { TimeSpan.FromMilliseconds(0), DispatcherPriority.ApplicationIdle };
63yield return new object?[] { TimeSpan.FromMilliseconds(0), DispatcherPriority.Background };
64yield return new object?[] { TimeSpan.FromMilliseconds(int.MaxValue), DispatcherPriority.ContextIdle };
65yield return new object?[] { TimeSpan.FromMilliseconds(0), DispatcherPriority.DataBind };
66yield return new object?[] { TimeSpan.FromMilliseconds(1), DispatcherPriority.Input };
67yield return new object?[] { TimeSpan.FromMilliseconds(2), DispatcherPriority.Loaded };
68yield return new object?[] { TimeSpan.FromMilliseconds(3), DispatcherPriority.Normal };
69yield return new object?[] { TimeSpan.FromMilliseconds(4), DispatcherPriority.Render };
70yield return new object?[] { TimeSpan.FromMilliseconds(5), DispatcherPriority.Send };
71yield return new object?[] { TimeSpan.FromMilliseconds(6), DispatcherPriority.SystemIdle };
76public void Ctor_TimeSpan_DispatcherPriority_EventHandler_Dispatcher(TimeSpan interval, DispatcherPriority priority)
94Assert.Throws<InvalidEnumArgumentException>("priority", () => new DispatcherTimer(TimeSpan.Zero, priority, (s, e) => {}, Dispatcher.CurrentDispatcher));
102Assert.Throws<ArgumentException>("priority", () => new DispatcherTimer(TimeSpan.Zero, DispatcherPriority.Inactive, (s, e) => {}, Dispatcher.CurrentDispatcher));
109Assert.Throws<ArgumentNullException>("dispatcher", () => new DispatcherTimer(TimeSpan.Zero, DispatcherPriority.Normal, (s, e) => {}, null));
114yield return new object[] { TimeSpan.FromTicks(-1) };
115yield return new object[] { TimeSpan.FromMilliseconds((double)int.MaxValue + 1) };
116yield return new object[] { TimeSpan.MinValue };
117yield return new object[] { TimeSpan.MaxValue };
122public void Ctor_InvalidInterval_ThrowsArgumentOutOfRangeException(TimeSpan interval)
130Assert.Throws<ArgumentNullException>("callback", () => new DispatcherTimer(TimeSpan.Zero, DispatcherPriority.Normal, null, Dispatcher.CurrentDispatcher));
155yield return new object[] { TimeSpan.Zero };
156yield return new object[] { TimeSpan.FromMilliseconds(1) };
157yield return new object[] { TimeSpan.FromMilliseconds(int.MaxValue) };
162public void Interval_Set_GetReturnsExpected(TimeSpan value)
177public void Interval_SetEnabled_GetReturnsExpected(TimeSpan value)
195public void Interval_SetInvalid_ThrowsArgumentOutOfRangeException(TimeSpan value)
xunit.assert (8)
EqualityAsserts.cs (8)
508 Equal(expected, actual, TimeSpan.Zero);
520 TimeSpan precision)
522 var difference = (expected - actual).Duration();
528 (precision == TimeSpan.Zero ? "" : string.Format(CultureInfo.CurrentCulture, " (difference {0} is larger than {1})", difference, precision));
542 Equal(expected, actual, TimeSpan.Zero);
554 TimeSpan precision)
556 var difference = (expected - actual).Duration();
562 (precision == TimeSpan.Zero ? "" : string.Format(CultureInfo.CurrentCulture, " (difference {0} is larger than {1})", difference, precision));
xunit.console (1)