Skip to content

Commit

Permalink
refactor: Smaller fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Mar 17, 2024
1 parent 15e2b30 commit 323641e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/LinkDotNet.NCronJob/InternalsVisibleTo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("NCronJob.Tests")]
9 changes: 3 additions & 6 deletions src/LinkDotNet.NCronJob/Scheduler/CronScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,9 @@ private Dictionary<DateTime, List<Run>> GetJobRuns()

foreach (var cron in registry.GetAllCronJobs())
{
var utcNow = DateTime.UtcNow;
var utcNow = timeProvider.GetUtcNow().DateTime;
var runDates = cron.CrontabSchedule.GetNextOccurrences(utcNow, utcNow.AddMinutes(1));
if (runDates is not null)
{
AddJobRuns(runMap, runDates, cron);
}
AddJobRuns(runMap, runDates, cron);
}

return runMap;
Expand All @@ -95,7 +92,7 @@ private static void AddJobRuns(

private DateTime UtcNowMinutePrecision()
{
var now = timeProvider.GetUtcNow();
var now = timeProvider.GetUtcNow().DateTime;
return new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, 0, DateTimeKind.Utc);
}

Expand Down

0 comments on commit 323641e

Please sign in to comment.