Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the time service to the newer fibers APIs and moves OS-facing time-sync responsibilities into HAL via a new time manager/driver that emits a time capability for services to consume.
Changes:
- Added a new
timeservice that discovers a HAL time capability, consumes retained sync state + transition events, and publishes system-widesvc/time/synced. - Added a HAL time manager + time driver that restarts
sysntpd, listens for NTP hotplug/ubus events, and emits capability meta/state/events. - Added time configuration stub plus a new time service spec document.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/services/time.lua | New time service consuming HAL time capability and publishing sync state/events. |
| src/services/hal/types/capabilities.lua | Refactors capability constructors to use fixed classes for several capability types. |
| src/services/hal/managers/time/ntp | Hotplug script to forward NTP updates via ubus events. |
| src/services/hal/managers/time.lua | New HAL time manager that installs the hotplug script and manages the time driver lifecycle. |
| src/services/hal/drivers/time.lua | New HAL time driver that restarts sysntpd, monitors ubus NTP events, and emits capability state/meta/events. |
| src/configs/config.json | Adds an empty time config section for HAL manager configuration consistency. |
| docs/specs/time.md | Documents the new time service behavior and bus topics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
22e65ac to
4252b7a
Compare
f1d7152 to
7ed23da
Compare
… set capability type directly
…capability handling
9e7230a to
49cef39
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (check all applicable)
Description
This is the migration of the time service to the new fibers library, as well as annotations and linting fixes.
The previous iteration of devicecode did not faithfully follow the distinction of what should be done via HAL, this mean service restarts and commands which should have been abstracted via the capability interface were instead being directly called in the time service. The new time service now interacts with a time driver which supplies time sync events and time accuracy metadata.
Added to HAL:
The time service currently only listens to once time capability, but will now be more capable to be extended to multiple time capabilities once modems expose their time functionalities in the future. Check the time spec for more detail.
Manual test
Manual test description
On a bigbox:
date -s "2025-11-18 15:00:00"DEVICECODE_CONFIG_DIR=./configs/ DEVICECODE_SERVICES=config,hal,gsm,time luajit main.luaYou should see the time in the logs jump from 15:00 to the current real time along with a log from the time service notifying of a time event
Added tests?
Added to documentation?