338 references to UtcNow
aspire (4)
Backchannel\ExtensionBackchannel.cs (2)
92var startTime = DateTimeOffset.UtcNow; 107var waitingFor = DateTimeOffset.UtcNow - startTime;
DotNet\DotNetCliRunner.cs (2)
589var startTime = DateTimeOffset.UtcNow; 621var waitingFor = DateTimeOffset.UtcNow - startTime;
Aspire.Azure.Security.KeyVault.Tests (1)
AspireKeyVaultExtensionsTests.cs (1)
161response.AddHeader(new HttpHeader("Date", DateTimeOffset.UtcNow.ToString("r", CultureInfo.InvariantCulture)));
Aspire.Cli.Tests (1)
Commands\RunCommandTests.cs (1)
178Timestamp = DateTimeOffset.UtcNow,
Aspire.Confluent.Kafka (14)
src\Vendoring\OpenTelemetry.Instrumentation.ConfluentKafka\InstrumentedConsumer.cs (6)
53DateTimeOffset start = DateTimeOffset.UtcNow; 70DateTimeOffset end = DateTimeOffset.UtcNow; 80DateTimeOffset start = DateTimeOffset.UtcNow; 97DateTimeOffset end = DateTimeOffset.UtcNow; 107DateTimeOffset start = DateTimeOffset.UtcNow; 124DateTimeOffset end = DateTimeOffset.UtcNow;
src\Vendoring\OpenTelemetry.Instrumentation.ConfluentKafka\InstrumentedProducer.cs (8)
45DateTimeOffset start = DateTimeOffset.UtcNow; 74DateTimeOffset end = DateTimeOffset.UtcNow; 92DateTimeOffset start = DateTimeOffset.UtcNow; 121DateTimeOffset end = DateTimeOffset.UtcNow; 136DateTimeOffset start = DateTimeOffset.UtcNow; 164DateTimeOffset end = DateTimeOffset.UtcNow; 177DateTimeOffset start = DateTimeOffset.UtcNow; 205DateTimeOffset end = DateTimeOffset.UtcNow;
Aspire.Dashboard (1)
DashboardEndpointsBuilder.cs (1)
79new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1) }); // consistent with theme cookie expiry
Aspire.Dashboard.Components.Tests (3)
Shared\IntegrationTestHelpers.cs (1)
16builder.AddXunit(testOutputHelper, LogLevel.Trace, DateTimeOffset.UtcNow);
tests\Shared\Logging\XunitLoggerProvider.cs (2)
71$"{(DateTimeOffset.UtcNow - _logStart.Value).TotalSeconds.ToString("N3", CultureInfo.InvariantCulture)}s" : 72DateTimeOffset.UtcNow.ToString("s", CultureInfo.InvariantCulture);
Aspire.Dashboard.Tests (3)
Integration\IntegrationTestHelpers.cs (1)
30builder.AddXunit(testOutputHelper, LogLevel.Trace, DateTimeOffset.UtcNow);
tests\Shared\Logging\XunitLoggerProvider.cs (2)
71$"{(DateTimeOffset.UtcNow - _logStart.Value).TotalSeconds.ToString("N3", CultureInfo.InvariantCulture)}s" : 72DateTimeOffset.UtcNow.ToString("s", CultureInfo.InvariantCulture);
Aspire.Hosting (3)
Backchannel\BackchannelLoggerProvider.cs (1)
80Timestamp = DateTimeOffset.UtcNow,
DistributedApplication.cs (2)
204var startedWaiting = DateTimeOffset.UtcNow; 216if (DateTimeOffset.UtcNow - startedWaiting > timeout)
Aspire.Hosting.Azure.Tests (18)
AzureBicepProvisionerTests.cs (4)
152Assert.True(token.ExpiresOn > DateTimeOffset.UtcNow); 170Assert.True(token.ExpiresOn > DateTimeOffset.UtcNow); 180new("mock-token", DateTimeOffset.UtcNow.AddHours(1)); 183ValueTask.FromResult(new AccessToken("mock-token", DateTimeOffset.UtcNow.AddHours(1)));
DefaultUserPrincipalProviderTests.cs (10)
104exp = DateTimeOffset.UtcNow.AddHours(1).ToUnixTimeSeconds(), 105iat = DateTimeOffset.UtcNow.ToUnixTimeSeconds() 127exp = DateTimeOffset.UtcNow.AddHours(1).ToUnixTimeSeconds(), 128iat = DateTimeOffset.UtcNow.ToUnixTimeSeconds() 151return new AccessToken(token, DateTimeOffset.UtcNow.AddHours(1)); 157return ValueTask.FromResult(new AccessToken(token, DateTimeOffset.UtcNow.AddHours(1))); 176return new AccessToken(token, DateTimeOffset.UtcNow.AddHours(1)); 186return ValueTask.FromResult(new AccessToken(token, DateTimeOffset.UtcNow.AddHours(1))); 197exp = DateTimeOffset.UtcNow.AddHours(1).ToUnixTimeSeconds(), 198iat = DateTimeOffset.UtcNow.ToUnixTimeSeconds()
ProvisioningTestHelpers.cs (4)
135return new AccessToken(token, DateTimeOffset.UtcNow.AddHours(1)); 142return ValueTask.FromResult(new AccessToken(token, DateTimeOffset.UtcNow.AddHours(1))); 157exp = DateTimeOffset.UtcNow.AddHours(1).ToUnixTimeSeconds(), 158iat = DateTimeOffset.UtcNow.ToUnixTimeSeconds()
Aspire.Hosting.Testing.Tests (2)
tests\Shared\Logging\XunitLoggerProvider.cs (2)
71$"{(DateTimeOffset.UtcNow - _logStart.Value).TotalSeconds.ToString("N3", CultureInfo.InvariantCulture)}s" : 72DateTimeOffset.UtcNow.ToString("s", CultureInfo.InvariantCulture);
Aspire.Hosting.Tests (2)
tests\Shared\Logging\XunitLoggerProvider.cs (2)
71$"{(DateTimeOffset.UtcNow - _logStart.Value).TotalSeconds.ToString("N3", CultureInfo.InvariantCulture)}s" : 72DateTimeOffset.UtcNow.ToString("s", CultureInfo.InvariantCulture);
Aspire.Playground.Tests (2)
tests\Shared\Logging\XunitLoggerProvider.cs (2)
71$"{(DateTimeOffset.UtcNow - _logStart.Value).TotalSeconds.ToString("N3", CultureInfo.InvariantCulture)}s" : 72DateTimeOffset.UtcNow.ToString("s", CultureInfo.InvariantCulture);
CdkSample.ApiService (3)
Program.cs (3)
164new SimpleDocument($"Foo:{DateTimeOffset.UtcNow}"), 165new SimpleDocument($"Bar:{DateTimeOffset.UtcNow}"), 166new SimpleDocument($"Baz:{DateTimeOffset.UtcNow}")
HttpAbstractions.SampleApp (1)
Program.cs (1)
43response.Cookies.Append("Cookie1", "value1", new CookieOptions() { Expires = DateTimeOffset.UtcNow + TimeSpan.FromDays(1) });
HttpStress (2)
Program.cs (2)
402X509Certificate2 cert = certReq.CreateSelfSigned(DateTimeOffset.UtcNow.AddMonths(-1), DateTimeOffset.UtcNow.AddMonths(1));
InMemory.FunctionalTests (3)
src\Servers\Kestrel\shared\test\CertificateAuthority.cs (3)
300DateTimeOffset now = DateTimeOffset.UtcNow; 509DateTimeOffset now = DateTimeOffset.UtcNow; 834DateTimeOffset start = DateTimeOffset.UtcNow;
Microsoft.AspNetCore.Components.Server (3)
Circuits\RemoteJSDataStream.cs (3)
73_lastDataReceivedTime = DateTimeOffset.UtcNow; 122_lastDataReceivedTime = DateTimeOffset.UtcNow; 198if (!_disposed && (DateTimeOffset.UtcNow >= _lastDataReceivedTime.Add(_jsInteropDefaultCallTimeout)))
Microsoft.AspNetCore.CookiePolicy.Test (1)
CookieChunkingTests.cs (1)
27var now = DateTimeOffset.UtcNow;
Microsoft.AspNetCore.DataProtection (1)
KeyManagement\XmlKeyManager.cs (1)
142internal Func<DateTimeOffset> GetUtcNow { get; set; } = () => DateTimeOffset.UtcNow;
Microsoft.AspNetCore.DataProtection.Extensions (2)
DataProtectionAdvancedExtensions.cs (1)
28return protector.Protect(plaintext, DateTimeOffset.UtcNow + lifetime);
TimeLimitedDataProtector.cs (1)
64return UnprotectCore(protectedData, DateTimeOffset.UtcNow, out expiration);
Microsoft.AspNetCore.DataProtection.Extensions.Tests (5)
DataProtectionAdvancedExtensionsTests.cs (5)
47DateTimeOffset lowerBound = DateTimeOffset.UtcNow.AddHours(48); 49DateTimeOffset upperBound = DateTimeOffset.UtcNow.AddHours(48); 70DateTimeOffset lowerBound = DateTimeOffset.UtcNow.AddHours(48); 72DateTimeOffset upperBound = DateTimeOffset.UtcNow.AddHours(48); 83var futureDate = DateTimeOffset.UtcNow.AddYears(1);
Microsoft.AspNetCore.DataProtection.Tests (13)
KeyManagement\CacheableKeyRingTests.cs (2)
22DateTimeOffset now = DateTimeOffset.UtcNow; 37DateTimeOffset now = DateTimeOffset.UtcNow;
KeyManagement\DeferredKeyTests.cs (2)
48var now = DateTimeOffset.UtcNow; 71var now = DateTimeOffset.UtcNow;
KeyManagement\KeyTests.cs (1)
38var now = DateTimeOffset.UtcNow;
KeyManagement\XmlKeyManagerTests.cs (8)
293DateTimeOffset minCreationDate = DateTimeOffset.UtcNow; 317Assert.InRange(actualCreationDate.Value, minCreationDate, DateTimeOffset.UtcNow); 722DateTimeOffset minRevocationDate = DateTimeOffset.UtcNow; 744Assert.InRange(actualRevocationDate.Value, minRevocationDate, DateTimeOffset.UtcNow); 807var creationDate = DateTimeOffset.UtcNow; 946var activationTime = DateTimeOffset.UtcNow.AddHours(1); 949keyManager.RevokeAllKeys(DateTimeOffset.UtcNow, "Revoking all keys"); // This should revoke key1 951keyManager.RevokeAllKeys(DateTimeOffset.UtcNow, "Revoking all keys"); // This should revoke key1 and key2
Microsoft.AspNetCore.DeveloperCertificates.XPlat.Tests (16)
CertificateManagerTests.cs (16)
44var now = DateTimeOffset.UtcNow; 137var now = DateTimeOffset.UtcNow; 169var now = DateTimeOffset.UtcNow; 202var now = DateTimeOffset.UtcNow; 233var now = DateTimeOffset.UtcNow; 266var now = DateTimeOffset.UtcNow; 293var now = DateTimeOffset.UtcNow; 333var now = DateTimeOffset.UtcNow; 364var now = DateTimeOffset.UtcNow; 384var now = DateTimeOffset.UtcNow; 402var now = DateTimeOffset.UtcNow; 423var now = DateTimeOffset.UtcNow; 444var now = DateTimeOffset.UtcNow; 461var now = DateTimeOffset.UtcNow; 479var now = DateTimeOffset.UtcNow; 530var now = DateTimeOffset.UtcNow;
Microsoft.AspNetCore.HeaderParsing.Tests (1)
HeaderParsingExtensionsTests.cs (1)
106var date = DateTimeOffset.UtcNow.ToString("R", CultureInfo.InvariantCulture);
Microsoft.AspNetCore.Http.Connections (1)
Internal\HttpConnectionManager.cs (1)
143var now = DateTimeOffset.UtcNow;
Microsoft.AspNetCore.Http.Connections.Tests (3)
HttpConnectionDispatcherTests.cs (3)
3282Assert.True(context.AuthenticationExpiration > DateTimeOffset.UtcNow); 3344Assert.True(context.AuthenticationExpiration > DateTimeOffset.UtcNow); 3444Assert.True(context.AuthenticationExpiration > DateTimeOffset.UtcNow);
Microsoft.AspNetCore.Http.Results (1)
src\Shared\ResultsHelpers\FileResultHelper.cs (1)
234var now = RoundDownToWholeSeconds(DateTimeOffset.UtcNow);
Microsoft.AspNetCore.Identity (2)
DataProtectorTokenProvider.cs (2)
83writer.Write(DateTimeOffset.UtcNow); 118if (expirationTime < DateTimeOffset.UtcNow)
Microsoft.AspNetCore.Identity.FunctionalTests (7)
MapIdentityApiTests.cs (5)
698var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); 739var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); 791var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); 838var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); 907var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
Pages\Account\Manage\EnableAuthenticator.cs (1)
49var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
src\Identity\Extensions.Core\src\Rfc6238AuthenticationService.cs (1)
84var delta = DateTimeOffset.UtcNow - DateTimeOffset.UnixEpoch;
Microsoft.AspNetCore.Identity.Specification.Tests (11)
UserManagerSpecificationTests.cs (11)
1160Assert.True(await mgr.GetLockoutEndDateAsync(user) > DateTimeOffset.UtcNow.AddMinutes(55)); 1182Assert.False(await mgr.GetLockoutEndDateAsync(user) > DateTimeOffset.UtcNow.AddMinutes(55)); 1186Assert.True(await mgr.GetLockoutEndDateAsync(user) > DateTimeOffset.UtcNow.AddMinutes(55)); 1207Assert.False(await mgr.GetLockoutEndDateAsync(user) > DateTimeOffset.UtcNow.AddMinutes(55)); 1212Assert.False(await mgr.GetLockoutEndDateAsync(user) > DateTimeOffset.UtcNow.AddMinutes(55)); 1215Assert.False(await mgr.GetLockoutEndDateAsync(user) > DateTimeOffset.UtcNow.AddMinutes(55)); 1238Assert.False(await mgr.GetLockoutEndDateAsync(user) > DateTimeOffset.UtcNow.AddMinutes(55)); 1242Assert.True(await mgr.GetLockoutEndDateAsync(user) > DateTimeOffset.UtcNow.AddMinutes(55)); 1289var user = CreateTestUser(lockoutEnd: DateTimeOffset.UtcNow.AddSeconds(-1)); 1306IdentityResultAssert.IsSuccess(await mgr.SetLockoutEndDateAsync(user, DateTimeOffset.UtcNow.AddSeconds(-1))); 1318var lockoutEnd = DateTimeOffset.UtcNow.AddMinutes(5);
Microsoft.AspNetCore.Identity.Test (6)
SecurityStampValidatorTest.cs (5)
63var ticket = new AuthenticationTicket(id, new AuthenticationProperties { IssuedUtc = DateTimeOffset.UtcNow }, IdentityConstants.ApplicationScheme); 81var properties = new AuthenticationProperties { IssuedUtc = DateTimeOffset.UtcNow.AddSeconds(-1), IsPersistent = isPersistent }; 141new AuthenticationProperties { IssuedUtc = DateTimeOffset.UtcNow.AddSeconds(-1) }, 182new AuthenticationProperties { IssuedUtc = DateTimeOffset.UtcNow.AddSeconds(-1) }, 261new AuthenticationProperties { IssuedUtc = DateTimeOffset.UtcNow },
UserManagerTest.cs (1)
1475async () => await manager.SetLockoutEndDateAsync(null, DateTimeOffset.UtcNow));
Microsoft.AspNetCore.InternalTesting (6)
AssemblyTestLog.cs (4)
68var logStart = DateTimeOffset.UtcNow; 186var logStart = DateTimeOffset.UtcNow; 337? $"{(DateTimeOffset.UtcNow - _logStart.Value).TotalSeconds.ToString("N3", CultureInfo.InvariantCulture)}s" 338: DateTimeOffset.UtcNow.ToString("s", CultureInfo.InvariantCulture)));
Logging\XunitLoggerProvider.cs (2)
73$"{(DateTimeOffset.UtcNow - _logStart.Value).TotalSeconds.ToString("N3", CultureInfo.InvariantCulture)}s" : 74DateTimeOffset.UtcNow.ToString("s", CultureInfo.InvariantCulture);
Microsoft.AspNetCore.Mvc.Core (1)
src\Shared\ResultsHelpers\FileResultHelper.cs (1)
234var now = RoundDownToWholeSeconds(DateTimeOffset.UtcNow);
Microsoft.AspNetCore.Mvc.FunctionalTests (3)
TempDataInCookiesUsingCookieConsentTest.cs (1)
114if (cookie.Expires == null || cookie.Expires >= DateTimeOffset.UtcNow)
TempDataPropertyTest.cs (1)
167if (cookie.Expires == null || cookie.Expires >= DateTimeOffset.UtcNow)
TempDataTestBase.cs (1)
270if (cookie.Expires == null || cookie.Expires >= DateTimeOffset.UtcNow)
Microsoft.AspNetCore.Mvc.TagHelpers.Test (2)
CacheTagHelperTest.cs (1)
194var expiresOn = DateTimeOffset.UtcNow.AddMinutes(4);
DistributedCacheTagHelperTest.cs (1)
248var expiresOn = DateTimeOffset.UtcNow.AddMinutes(4);
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (3)
EndToEndBenchmarks.cs (3)
127var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK) 143var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK) 160var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK)
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (3)
RedisOutputCacheStore.cs (3)
35private long _lastConnectTicks = DateTimeOffset.UtcNow.Ticks; 370var utcNow = DateTimeOffset.UtcNow; 415WriteTimeTicks(ref _lastConnectTicks, DateTimeOffset.UtcNow);
Microsoft.AspNetCore.OutputCaching.Tests (36)
MemoryOutputCacheStoreTests.cs (7)
28var testClock = new TestMemoryOptionsClock { UtcNow = DateTimeOffset.UtcNow }; 64var testClock = new TestMemoryOptionsClock { UtcNow = DateTimeOffset.UtcNow }; 92var testClock = new TestMemoryOptionsClock { UtcNow = DateTimeOffset.UtcNow }; 112var testClock = new TestMemoryOptionsClock { UtcNow = DateTimeOffset.UtcNow }; 128var testClock = new TestMemoryOptionsClock { UtcNow = DateTimeOffset.UtcNow }; 158var testClock = new TestMemoryOptionsClock { UtcNow = DateTimeOffset.UtcNow }; 203var testClock = new TestMemoryOptionsClock { UtcNow = DateTimeOffset.UtcNow };
OutputCacheMiddlewareTests.cs (24)
77using (var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK)) 107using (var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK) 136using (var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK)) 162using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 172var utcNow = DateTimeOffset.UtcNow; 176using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 210var utcNow = DateTimeOffset.UtcNow; 214using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 252var utcNow = DateTimeOffset.UtcNow; 256using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 273var utcNow = DateTimeOffset.UtcNow; 277using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 295using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 324using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK) 341using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 356using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 536var utcNow = DateTimeOffset.UtcNow; 556var utcNow = DateTimeOffset.UtcNow; 615using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 644using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 677using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 702using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 774using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK); 978using var entry = new OutputCacheEntry(DateTimeOffset.UtcNow, StatusCodes.Status200OK);
OutputCachePolicyProviderTests.cs (3)
338var utcNow = DateTimeOffset.UtcNow; 353var utcNow = DateTimeOffset.UtcNow; 376var utcNow = DateTimeOffset.UtcNow;
TestUtils.cs (2)
36headers.Date = DateTimeOffset.UtcNow; 238ResponseTime = DateTimeOffset.UtcNow
Microsoft.AspNetCore.ResponseCaching.Tests (21)
ResponseCachingMiddlewareTests.cs (5)
190var utcNow = DateTimeOffset.UtcNow; 221var utcNow = DateTimeOffset.UtcNow; 255var utcNow = DateTimeOffset.UtcNow; 274var utcNow = DateTimeOffset.UtcNow; 620var utcNow = DateTimeOffset.UtcNow;
ResponseCachingPolicyProviderTests.cs (13)
371var utcNow = DateTimeOffset.UtcNow; 389var utcNow = DateTimeOffset.UtcNow; 404var utcNow = DateTimeOffset.UtcNow; 424var utcNow = DateTimeOffset.UtcNow; 446var utcNow = DateTimeOffset.UtcNow; 466var utcNow = DateTimeOffset.UtcNow; 488var utcNow = DateTimeOffset.UtcNow; 502var utcNow = DateTimeOffset.UtcNow; 520var utcNow = DateTimeOffset.UtcNow; 541var utcNow = DateTimeOffset.UtcNow; 561var utcNow = DateTimeOffset.UtcNow; 583var utcNow = DateTimeOffset.UtcNow; 604var utcNow = DateTimeOffset.UtcNow;
TestUtils.cs (3)
55headers.Date = DateTimeOffset.UtcNow; 231ResponseTime = DateTimeOffset.UtcNow 239ResponseTime = DateTimeOffset.UtcNow
Microsoft.AspNetCore.Rewrite (9)
PatternSegments\DateTimeSegment.cs (8)
50return DateTimeOffset.UtcNow.Year.ToString(CultureInfo.InvariantCulture); 52return DateTimeOffset.UtcNow.Month.ToString(CultureInfo.InvariantCulture); 54return DateTimeOffset.UtcNow.Day.ToString(CultureInfo.InvariantCulture); 56return DateTimeOffset.UtcNow.Hour.ToString(CultureInfo.InvariantCulture); 58return DateTimeOffset.UtcNow.Minute.ToString(CultureInfo.InvariantCulture); 60return DateTimeOffset.UtcNow.Second.ToString(CultureInfo.InvariantCulture); 62return ((int)DateTimeOffset.UtcNow.DayOfWeek).ToString(CultureInfo.InvariantCulture); 64return DateTimeOffset.UtcNow.ToString(CultureInfo.InvariantCulture);
UrlActions\ChangeCookieAction.cs (1)
14: this(name, () => DateTimeOffset.UtcNow)
Microsoft.AspNetCore.Rewrite.Tests (1)
UrlActions\ChangeCookieActionTests.cs (1)
15var now = DateTimeOffset.UtcNow;
Microsoft.AspNetCore.Server.HttpSys (1)
RequestProcessing\RequestContext.FeatureCollection.cs (1)
705var expiresOffset = expirationDate - DateTimeOffset.UtcNow;
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (7)
CertificatePathWatcherTests.cs (3)
128var fileLastModifiedTime = DateTimeOffset.UtcNow; 178var fileLastModifiedTime = DateTimeOffset.UtcNow; 350var fileLastModifiedTime = DateTimeOffset.UtcNow;
PinnedBlockMemoryPoolFactoryTests.cs (1)
66var timeProvider = new FakeTimeProvider(DateTimeOffset.UtcNow.AddDays(1));
src\Servers\Kestrel\shared\test\CertificateAuthority.cs (3)
300DateTimeOffset now = DateTimeOffset.UtcNow; 509DateTimeOffset now = DateTimeOffset.UtcNow; 834DateTimeOffset start = DateTimeOffset.UtcNow;
Microsoft.AspNetCore.Server.Kestrel.Tests (2)
KestrelConfigurationLoaderTests.cs (2)
937var notBefore = DateTimeOffset.UtcNow.AddDays(-1); 938var notAfter = DateTimeOffset.UtcNow.AddYears(1);
Microsoft.AspNetCore.StaticAssets (1)
StaticAssetsInvoker.cs (1)
340var now = DateTimeOffset.UtcNow;
Microsoft.AspNetCore.StaticAssets.Tests (3)
StaticAssetsIntegrationTests.cs (3)
326var lastModified = DateTimeOffset.UtcNow; 492var lastModified = DateTimeOffset.UtcNow; 927req2.Headers.TryAddWithoutValidation("If-Modified-Since", DateTimeOffset.UtcNow.ToString(format, CultureInfo.InvariantCulture));
Microsoft.AspNetCore.StaticFiles (1)
StaticFileContext.cs (1)
181var now = DateTimeOffset.UtcNow;
Microsoft.AspNetCore.StaticFiles.Tests (1)
CacheHeaderTests.cs (1)
355.AddHeader("If-Modified-Since", DateTimeOffset.UtcNow.ToString(format, CultureInfo.InvariantCulture))
Microsoft.AspNetCore.Testing (2)
FakeSslCertificateFactory.cs (2)
42return request.CreateSelfSigned(DateTimeOffset.UtcNow.AddDays(-1), DateTimeOffset.UtcNow.AddYears(1));
Microsoft.DotNet.ArcadeLogging (2)
PipelinesLogger.cs (2)
234endTime: DateTimeOffset.UtcNow, 382StartTime = DateTimeOffset.UtcNow;
Microsoft.DotNet.Build.Tasks.Feed (1)
src\common\AzureStorageUtils.cs (1)
153ExpiresOn = DateTimeOffset.UtcNow.AddDays(tokenExpirationInDays)
Microsoft.DotNet.Build.Tasks.Feed.Tests (2)
ProductionChannelValidatorTests.cs (1)
59dateProduced: dateProduced ?? DateTimeOffset.UtcNow,
PublishArtifactsInManifestTests.cs (1)
105dateProduced: dateProduced ?? DateTimeOffset.UtcNow,
Microsoft.DotNet.Build.Tasks.Installers (2)
src\RpmBuilder.cs (2)
211entries.Add(new(RpmHeaderTag.ChangelogTimestamp, RpmHeaderEntryType.Int32, _changelogLines.Select(_ => (int)(DateTimeOffset.UtcNow - UnixEpoch).TotalSeconds).ToArray())); 213entries.Add(new(RpmHeaderTag.BuildTime, RpmHeaderEntryType.Int32, new[] { (int)(DateTimeOffset.UtcNow - UnixEpoch).TotalSeconds }));
Microsoft.DotNet.XUnitAssert.Tests (1)
Sdk\ArgumentFormatterTests.cs (1)
178 var now = DateTimeOffset.UtcNow;
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvokingChatClient.cs (1)
414CreatedAt = DateTimeOffset.UtcNow,
Microsoft.Extensions.AI.AzureAIInference (2)
AzureAIInferenceEmbeddingGenerator.cs (1)
101CreatedAt = DateTimeOffset.UtcNow,
AzureAIInferenceImageEmbeddingGenerator.cs (1)
97CreatedAt = DateTimeOffset.UtcNow,
Microsoft.Extensions.AI.OpenAI (1)
OpenAIEmbeddingGenerator.cs (1)
70CreatedAt = DateTimeOffset.UtcNow,
Microsoft.Extensions.AI.Tests (3)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (2)
26CreatedAt = DateTimeOffset.UtcNow, 109CreatedAt = DateTimeOffset.UtcNow,
ChatCompletion\DistributedCachingChatClientTest.cs (1)
70CreatedAt = DateTimeOffset.UtcNow,
Microsoft.Extensions.Caching.Abstractions (1)
Internal\SystemClock.cs (1)
20return DateTimeOffset.UtcNow;
Microsoft.Extensions.Caching.Hybrid.Tests (2)
DistributedCacheTests.cs (2)
33public void Reset() => UtcNow = DateTimeOffset.UtcNow; 35public DateTimeOffset UtcNow { get; private set; } = DateTimeOffset.UtcNow;
Microsoft.Extensions.Caching.StackExchangeRedis (5)
RedisCache.cs (5)
52private long _lastConnectTicks = DateTimeOffset.UtcNow.Ticks; 169var creationTime = DateTimeOffset.UtcNow; 219var creationTime = DateTimeOffset.UtcNow; 359WriteTimeTicks(ref _lastConnectTicks, DateTimeOffset.UtcNow); 637var utcNow = DateTimeOffset.UtcNow;
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (15)
Linux\AcceptanceTest.cs (3)
212var clock = new FakeTimeProvider(DateTimeOffset.UtcNow); 307var clock = new FakeTimeProvider(DateTimeOffset.UtcNow); 414var clock = new FakeTimeProvider(DateTimeOffset.UtcNow);
Linux\LinuxCountersTests.cs (1)
90var lnm = new LinuxNetworkMetrics(meterFactoryMock.Object, tcpStateInfo, new FakeTimeProvider(DateTimeOffset.UtcNow));
Linux\LinuxNetworkMetricsTests.cs (1)
23private readonly DateTimeOffset _startTime = DateTimeOffset.UtcNow;
Linux\LinuxUtilizationProviderTests.cs (2)
318var fakeTime = new FakeTimeProvider(DateTimeOffset.UtcNow); 384var fakeTime = new FakeTimeProvider(DateTimeOffset.UtcNow);
Windows\Tcp6TableInfoTests.cs (3)
22public static DateTimeOffset StartTimestamp = DateTimeOffset.UtcNow; 55if (DateTimeOffset.UtcNow < NextTimestamp) 265StartTimestamp = DateTimeOffset.UtcNow;
Windows\TcpTableInfoTests.cs (3)
19public static DateTimeOffset StartTimestamp = DateTimeOffset.UtcNow; 48if (DateTimeOffset.UtcNow < NextTimestamp) 207StartTimestamp = DateTimeOffset.UtcNow;
Windows\WindowsCountersTests.cs (2)
20TcpTableInfoTests.StartTimestamp = DateTimeOffset.UtcNow; 22Tcp6TableInfoTests.StartTimestamp = DateTimeOffset.UtcNow;
Microsoft.Extensions.FileProviders.Embedded (2)
EmbeddedFileProvider.cs (1)
56_lastModified = DateTimeOffset.UtcNow;
ManifestEmbeddedFileProvider.cs (1)
128var result = DateTimeOffset.UtcNow;
Microsoft.Extensions.FileProviders.Embedded.Tests (2)
ManifestEmbeddedFileProviderTests.cs (2)
433var scopedProvider = new ManifestEmbeddedFileProvider(assembly, provider.Manifest.Scope("wwwroot"), DateTimeOffset.UtcNow); 461var scopedProvider = new ManifestEmbeddedFileProvider(assembly, provider.Manifest.Scope("wwwroot"), DateTimeOffset.UtcNow);
Microsoft.Extensions.Http.Diagnostics.Tests (1)
Logging\HttpClientLoggerTest.cs (1)
848var fakeTimeProvider = new FakeTimeProvider(DateTimeOffset.UtcNow);
Microsoft.Extensions.Identity.Core (4)
AuthenticatorTokenProvider.cs (1)
60var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
Rfc6238AuthenticationService.cs (1)
84var delta = DateTimeOffset.UtcNow - DateTimeOffset.UnixEpoch;
UserManager.cs (2)
2101return lockoutTime >= DateTimeOffset.UtcNow; 2223await store.SetLockoutEndDateAsync(user, DateTimeOffset.UtcNow.Add(Options.Lockout.DefaultLockoutTimeSpan),
Microsoft.Extensions.Logging.AzureAppServices (1)
BlobAppendReferenceWrapper.cs (1)
79message.Headers.Date = DateTimeOffset.UtcNow;
Microsoft.Extensions.Logging.Console (3)
JsonConsoleFormatter.cs (1)
46? (FormatterOptions.UseUtcTimestamp ? DateTimeOffset.UtcNow : DateTimeOffset.Now)
SimpleConsoleFormatter.cs (1)
159? (FormatterOptions.UseUtcTimestamp ? DateTimeOffset.UtcNow : DateTimeOffset.Now)
SystemdConsoleFormatter.cs (1)
116? (FormatterOptions.UseUtcTimestamp ? DateTimeOffset.UtcNow : DateTimeOffset.Now)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (2)
tests\Shared\Logging\XunitLoggerProvider.cs (2)
71$"{(DateTimeOffset.UtcNow - _logStart.Value).TotalSeconds.ToString("N3", CultureInfo.InvariantCulture)}s" : 72DateTimeOffset.UtcNow.ToString("s", CultureInfo.InvariantCulture);
Microsoft.Extensions.TimeProvider.Testing.Tests (3)
FakeTimeProviderTests.cs (1)
444var timeProvider = new FakeTimeProvider(DateTimeOffset.UtcNow)
TimerTests.cs (2)
251var timeProvider = new FakeTimeProvider(DateTimeOffset.UtcNow); 274var timeProvider = new FakeTimeProvider(DateTimeOffset.UtcNow);
Microsoft.Gen.Logging.Generated.Tests (1)
test\Generators\Microsoft.Gen.Logging\TestClasses\LogPropertiesExtensions.cs (1)
123public DateTimeOffset DateTimeOffsetProperty { get; set; } = DateTimeOffset.UtcNow;
Microsoft.Maui.Essentials (1)
Types\Location.shared.cs (1)
54 public Location(double latitude, double longitude) : this(latitude, longitude, DateTimeOffset.UtcNow)
OpenIdConnectSample (1)
Startup.cs (1)
271var expiresAt = DateTimeOffset.UtcNow + TimeSpan.FromSeconds(seconds);
SocialSample (2)
Startup.cs (2)
345var expiresAt = DateTimeOffset.UtcNow + TimeSpan.FromSeconds(seconds); 375var expiresAt = DateTimeOffset.UtcNow + TimeSpan.FromSeconds(seconds);
Sockets.FunctionalTests (4)
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (4)
1124var startTime = DateTimeOffset.UtcNow; 1135var timeElapsed = DateTimeOffset.UtcNow - startTime; 1148var startTime = DateTimeOffset.UtcNow; 1156var timeElapsed = DateTimeOffset.UtcNow - startTime;
Stress.ApiService (1)
TraceCreator.cs (1)
105activity.AddEvent(new ActivityEvent($"event-{i}", DateTimeOffset.UtcNow.AddMilliseconds(1), activityTags));
System.Diagnostics.DiagnosticSource (2)
System\Diagnostics\ActivityEvent.cs (2)
21public ActivityEvent(string name) : this(name, DateTimeOffset.UtcNow, tags: null) 38Timestamp = timestamp != default ? timestamp : DateTimeOffset.UtcNow;
System.Formats.Tar (1)
System\Formats\Tar\TarEntry.cs (1)
49_header = new TarHeader(format, entryName, TarHelpers.GetDefaultMode(entryType), DateTimeOffset.UtcNow, entryType);
System.Net.Security (5)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (1)
70expiration = DateTimeOffset.UtcNow.AddMinutes(30);
System\Net\Security\SslStreamCertificateContext.Linux.cs (4)
170DateTimeOffset now = DateTimeOffset.UtcNow; 208return ValueTask.FromResult(DateTimeOffset.UtcNow <= _ocspExpiration ? _ocspResponse : null); 338DateTimeOffset nextCheckA = DateTimeOffset.UtcNow.Add(DefaultOcspRefreshInterval); 366_nextDownload = DateTimeOffset.UtcNow.Add(RefreshAfterFailureBackOffInterval);
System.Private.CoreLib (8)
src\libraries\Common\src\System\TimeProvider.cs (4)
14/// Gets a <see cref="TimeProvider"/> that provides a clock based on <see cref="DateTimeOffset.UtcNow"/>, 36/// The default implementation returns <see cref="DateTimeOffset.UtcNow"/>. 38public virtual DateTimeOffset GetUtcNow() => DateTimeOffset.UtcNow; 239/// provided by <see cref="TimeProvider"/> which uses <see cref="DateTimeOffset.UtcNow"/>, <see cref="TimeZoneInfo.Local"/>, <see cref="Stopwatch"/>, and <see cref="Timer"/>.
src\libraries\System.Private.CoreLib\src\System\DateTimeOffset.cs (2)
388/// If you rely on properties such as <see cref="Now"/> or <see cref="UtcNow"/> to accurately track the number of elapsed microseconds, 398/// If you rely on properties such as <see cref="Now"/> or <see cref="UtcNow"/> to accurately track the number of elapsed nanosecond,
src\libraries\System.Private.CoreLib\src\System\Guid.cs (2)
294/// <para>This uses <see cref="DateTimeOffset.UtcNow" /> to determine the Unix Epoch timestamp source.</para> 297public static Guid CreateVersion7() => CreateVersion7(DateTimeOffset.UtcNow);
System.Private.Windows.Core.Tests (1)
System\Value\StoringDateTimeOffset.cs (1)
11{ DateTimeOffset.UtcNow },
System.Security.Cryptography (9)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (1)
70expiration = DateTimeOffset.UtcNow.AddMinutes(30);
System\Security\Cryptography\X509Certificates\CertificateRequest.cs (5)
661/// Typically <see cref="DateTimeOffset.UtcNow"/>, plus or minus a few seconds. 724/// Typically <see cref="DateTimeOffset.UtcNow"/>, plus or minus a few seconds. 782/// Typically <see cref="DateTimeOffset.UtcNow"/>, plus or minus a few seconds. 937/// Typically <see cref="DateTimeOffset.UtcNow"/>, plus or minus a few seconds. 982/// Typically <see cref="DateTimeOffset.UtcNow"/>, plus or minus a few seconds.
System\Security\Cryptography\X509Certificates\CertificateRevocationListBuilder.Build.cs (2)
121thisUpdate.GetValueOrDefault(DateTimeOffset.UtcNow), 321thisUpdate.GetValueOrDefault(DateTimeOffset.UtcNow),
System\Security\Cryptography\X509Certificates\CertificateRevocationListBuilder.cs (1)
203RevocationTime = (revocationTime ?? DateTimeOffset.UtcNow).ToUniversalTime(),
System.ServiceModel.Syndication (2)
System\ServiceModel\Syndication\Atom10FeedFormatter.cs (2)
402lastUpdatedTime = DateTimeOffset.UtcNow; 437lastUpdatedTime = DateTimeOffset.UtcNow;
System.Windows.Forms.UI.IntegrationTests (1)
Infra\DataCollectionService.cs (1)
160var timestamp = DateTimeOffset.UtcNow;
WebTransportInteractiveSampleApp (2)
Program.cs (2)
172if (DateTime.Parse(cert.GetExpirationDateString(), null) >= DateTimeOffset.UtcNow) 179var now = DateTimeOffset.UtcNow;
WebTransportSampleApp (2)
Program.cs (2)
57if (DateTime.Parse(cert.GetExpirationDateString(), null) < DateTimeOffset.UtcNow) 65var now = DateTimeOffset.UtcNow;