When evaluating twilight restriction, shift dusk to next day when it happens before dawn on the same day.
ClosedPublic

Authored by TallFurryMan on Jul 11 2019, 6:44 AM.

Details

Summary

Near the summer solstice, it may happen that dusk occurs before dawn on the same day.
The twilight restriction did not take this situation into account, and was unable to shift restricted jobs to the next dusk.

This change shifts dusk to the next day when it happens before dawn on the same day, resolving this issue when evaluating jobs.
This change also fixes the accompanying exception on dark sky score occurring when debugging in that situation, as the job was occuring during daytime.

Test Plan

Test during a period of the year where dusk happens after the local midnight, so that "dusk happens before dawn", for instance around 1am.
Test during daytime, so that a default ASAP job would happen during the day (this is not required given the execution path, but makes the end-user issue obvious).
Add a single job on a circumpolar target, with twilight restriction, ASAP startup, and let Scheduler evaluate.

  • Without this change, job startup is left unmodified although it will start during daytime. An exception happens if debugging.
  • With this change, job startup is properly shifted to next dusk, on the following day. No exception is triggered.

Diff Detail

Repository
R321 KStars
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
TallFurryMan created this revision.Jul 11 2019, 6:44 AM
Restricted Application added a project: KDE Edu. · View Herald TranscriptJul 11 2019, 6:44 AM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
TallFurryMan requested review of this revision.Jul 11 2019, 6:44 AM
wreissenberger accepted this revision.Jul 13 2019, 8:03 PM

Works as described, good point!

This revision is now accepted and ready to land.Jul 13 2019, 8:03 PM
This revision was automatically updated to reflect the committed changes.