Skip to content

subsys/cron: move the cron scheduler out of services - #2100

Merged
gmarull merged 1 commit into
coredevices:mainfrom
teslabs:cron-subsys
Sep 18, 2026
Merged

gmarull merged 1 commit into
coredevices:mainfrom
teslabs:cron-subsys

Conversation

@gmarull

@gmarull gmarull commented Sep 17, 2026

Copy link
Copy Markdown
Member

Summary

  • Moves the wall-clock job scheduler from src/fw/services/cron to subsys/cron, alongside logging.
  • Collapses the job API (<pebbleos/cron.h>) and control API (pbl/services/cron.h) into a single <pbl/cron/cron.h>, fully pbl-namespaced: struct pbl_cron_job, pbl_cron_job_cb_t, pbl_cron_job_*(), pbl_cron_init(), pbl_cron_handle_clock_change(), PBL_CRON_*_ANY and PBL_CRON_WDAY_*.
  • CONFIG_SERVICE_CRON becomes CONFIG_CRON (log module cron).
  • pbl_cron_handle_clock_change() takes the UTC delta, GMT offset delta and DST flag directly instead of a PebbleSetTimeEvent, so the subsystem no longer depends on kernel/events.h.
  • The old header declared cron_job_schedule_after(new_job, job) while the implementation and its only caller used (job, new_job); the header now matches the implementation. No behaviour change.

Test plan

  • Full unit test suite (333/333 pass)
  • asterix firmware build; .config shows CONFIG_CRON=y with the log-level symbols generated
  • Not tested on hardware

🤖 Generated with Claude Code

@gmarull
gmarull requested a review from jplexer as a code owner September 17, 2026 14:24
The wall-clock job scheduler has no firmware-specific state and is used
by activity, alarms and the timeline peek, so it belongs with the other
OS subsystems. src/fw/services/cron becomes subsys/cron, the job API
(<pebbleos/cron.h>) and the control API (pbl/services/cron.h) collapse
into a single <pbl/cron/cron.h>, and the whole surface takes the pbl
namespace: struct pbl_cron_job, pbl_cron_job_cb_t, pbl_cron_job_*(),
pbl_cron_init(), pbl_cron_handle_clock_change() and the PBL_CRON_*_ANY
and PBL_CRON_WDAY_* selectors. CONFIG_SERVICE_CRON becomes CONFIG_CRON
and the log module is now "cron".

pbl_cron_handle_clock_change() takes the UTC delta, GMT offset delta and
DST flag directly instead of a PebbleSetTimeEvent, so the subsystem no
longer includes kernel/events.h.

The old header declared cron_job_schedule_after(new_job, job) while the
implementation and its only caller used (job, new_job); the header now
matches the implementation.

Verified with the full unit test suite and an asterix build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
@gmarull
gmarull merged commit 3be9ad3 into coredevices:main Sep 18, 2026
48 checks passed
@gmarull
gmarull deleted the cron-subsys branch September 18, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants