Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When epoch time crosses over the 65536 boundary, AlarmMgr fails #35

Open
gcohler opened this issue Sep 29, 2024 · 0 comments
Open

When epoch time crosses over the 65536 boundary, AlarmMgr fails #35

gcohler opened this issue Sep 29, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@gcohler
Copy link
Collaborator

gcohler commented Sep 29, 2024

When the epoch time seconds value grows bigger than 65536, alarm manager fails. Run the geof/replace-shifts branch's combo program, and watch the console logging, and you'll see the problem within 20s.

I think the problem is that secs and sub_secs are combined into ticks -- and that ticks therefore needs to be a u64 (or i64) to be able to avoid wrapping. The same might apply to secs256 units.

My overall suggestion is to get rid of secs and sub_secs and secs256, and to store time in an i64 (more in keeping with zig's std.time). In that way the arithmetic will be handled properly, and we'll have a more common time unit (milli-, micro-, or nano- seconds), and we can adjust the underlying hardware's time at the lower levels of the code, and applications will not need to know the underlying units.

In this light, one might consider AlarmMgr to be an application that should not need to deal in ticks or secs256 or anything other than milliseconds.

@gcohler gcohler added the bug Something isn't working label Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants