Skip to content

Commit

Permalink
Handle solar noon in scheduler and add tests to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
t1m0thyj committed Jan 8, 2024
1 parent 06825b3 commit fb65795
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ jobs:
with:
name: msix-${{ matrix.platform }}
path: uwp\AppPackages\**\*.msix

- run: dotnet test --verbosity normal
working-directory: test
8 changes: 4 additions & 4 deletions src/SolarScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static List<DateTime> GetAllImageTimes(ThemeConfig theme)
{
if (data.polarPeriod == PolarPeriod.PolarDay)
{
times.Add(DateTime.Today + TimeSpan.FromTicks(TimeSpan.FromDays(1).Ticks * i / theme.dayImageList.Length));
times.Add(data.solarNoon.AddHours(-12) + TimeSpan.FromTicks(TimeSpan.FromDays(1).Ticks * i / theme.dayImageList.Length));
}
else
{
Expand All @@ -63,7 +63,7 @@ public static List<DateTime> GetAllImageTimes(ThemeConfig theme)
{
if (data.polarPeriod == PolarPeriod.PolarNight)
{
times.Add(DateTime.Today + TimeSpan.FromTicks(TimeSpan.FromDays(1).Ticks * i / theme.nightImageList.Length));
times.Add(data.solarNoon.AddHours(-12) + TimeSpan.FromTicks(TimeSpan.FromDays(1).Ticks * i / theme.nightImageList.Length));
}
else
{
Expand Down Expand Up @@ -170,8 +170,8 @@ public static void CalcNextUpdateTime(SolarData data, DisplayEvent e)
{
imageList = e.currentTheme?.nightImageList;
}
segmentStart = dateNow.Date;
segmentEnd = dateNow.Date.AddDays(1);
segmentStart = data.solarNoon.AddHours(-12);
segmentEnd = data.solarNoon.AddHours(12).AddTicks(-1);
}
else if (!preferSegment2)
{
Expand Down

0 comments on commit fb65795

Please sign in to comment.