Skip to content

Commit

Permalink
scheduler: naming
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed May 22, 2024
1 parent f8ff6f8 commit adf0180
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions code/espurna/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1261,11 +1261,11 @@ namespace restore {
[[gnu::used]]
void Context::init() {
#if SCHEDULER_SUN_SUPPORT
const auto seconds = datetime::Seconds{ this->delta.timestamp };
const auto seconds = datetime::Seconds{ this->current.timestamp };
const auto minutes =
std::chrono::duration_cast<datetime::Minutes>(seconds);

sun::update(minutes, this->delta.utc);
sun::update(minutes, this->current.utc);
#endif
}

Expand Down
10 changes: 5 additions & 5 deletions code/espurna/scheduler_common.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ struct Context {

explicit Context(const datetime::Context& ctx) :
base(ctx),
delta(ctx)
current(ctx)
{
init();
}
Expand All @@ -376,7 +376,7 @@ struct Context {

const datetime::Context& base;

datetime::Context delta{};
datetime::Context current{};
datetime::Days days{};

std::vector<Pending> pending{};
Expand All @@ -394,8 +394,8 @@ bool Context::next_delta(const datetime::Days& days) {
}

this->days += days;
this->delta = datetime::delta(delta, days);
if (this->delta.timestamp < 0) {
this->current = datetime::delta(this->current, days);
if (this->current.timestamp < 0) {
return false;
}

Expand Down Expand Up @@ -508,7 +508,7 @@ bool handle_delta(Context& ctx, const Pending& pending) {
return false;
}

const auto& time_point = select_time(ctx.delta, pending.schedule);
const auto& time_point = select_time(ctx.current, pending.schedule);

if (match(pending.schedule.date, time_point) && match(pending.schedule.weekdays, time_point)) {
datetime::Minutes offset{ ctx.days - datetime::Days{ -1 }};
Expand Down

0 comments on commit adf0180

Please sign in to comment.