Fix the time-since computation in HPA.

nstime module guarantees monotonic clock update within a single nstime_t.  This
means, if two separate nstime_t variables are read and updated separately,
nstime_subtract between them may result in underflow.  Fixed by switching to the
time since utility provided by nstime.
This commit is contained in:
Qi Wang
2021-12-20 15:04:12 -08:00
committed by Qi Wang
parent 310af725b0
commit 837b37c4ce
4 changed files with 22 additions and 15 deletions

View File

@@ -9,6 +9,7 @@ struct hpa_hooks_s {
void (*hugify)(void *ptr, size_t size);
void (*dehugify)(void *ptr, size_t size);
void (*curtime)(nstime_t *r_time, bool first_reading);
uint64_t (*ms_since)(nstime_t *r_time);
};
extern hpa_hooks_t hpa_hooks_default;