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

Added method to retrieve time to next time critical job #641

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/lmic/oslmic.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,10 @@ bit_t os_queryTimeCriticalJobs(ostime_t time) {
else
return 0;
}

ostime_t os_timeToNextTimeCriticalJob() {
if (OS.runnablejobs) return 0;

if (!OS.scheduledjobs) return 0x7FFFFFFFl;//ostime_t_max;
return OS.scheduledjobs->deadline - os_getTime();
}
4 changes: 4 additions & 0 deletions src/lmic/oslmic.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ u1_t os_getBattLevel (void);
//! Return non-zero if any jobs are scheduled between now and now+time.
bit_t os_queryTimeCriticalJobs(ostime_t time);
#endif
#ifndef os_timeToNextTimeCriticalJob
// return the time to the next scheduled job, or ostime_t_max if no job is scheduled
ostime_t os_timeToNextTimeCriticalJob();
#endif

#ifndef os_rlsbf4
//! Read 32-bit quantity from given pointer in little endian byte order.
Expand Down