Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit ff8c52a

Browse files
committed
No need for ToUniversalTime()
Scheduler.Now returns UtcNow and it would be nice if that were documented.
1 parent 211221a commit ff8c52a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/GitHub.App/Extensions/AkavacheExtensions.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static IObservable<T> GetAndRefreshObject<T>(
3838
{
3939
return Observable.Defer(() =>
4040
{
41-
var absoluteExpiration = blobCache.Scheduler.Now.ToUniversalTime() + maxCacheDuration;
41+
var absoluteExpiration = blobCache.Scheduler.Now + maxCacheDuration;
4242

4343
try
4444
{
@@ -148,7 +148,7 @@ public static IObservable<T> GetAndFetchLatestFromIndex<T>(
148148
{
149149
return Observable.Defer(() =>
150150
{
151-
var absoluteExpiration = blobCache.Scheduler.Now.ToUniversalTime() + maxCacheDuration;
151+
var absoluteExpiration = blobCache.Scheduler.Now + maxCacheDuration;
152152

153153
try
154154
{
@@ -201,8 +201,7 @@ static IObservable<T> GetAndFetchLatestFromIndex<T>(this IBlobCache This,
201201

202202
static bool IsExpired(IBlobCache blobCache, DateTimeOffset itemCreatedAt, TimeSpan cacheDuration)
203203
{
204-
var now = blobCache.Scheduler.Now.ToUniversalTime();
205-
var elapsed = now - itemCreatedAt.ToUniversalTime();
204+
var elapsed = blobCache.Scheduler.Now - itemCreatedAt.ToUniversalTime();
206205

207206
return elapsed > cacheDuration;
208207
}

0 commit comments

Comments
 (0)