Use monotonic clock for thermal sampling intervals and model time axis

This commit is contained in:
Andrea Mazzoleni 2026-09-07 00:04:49 +02:00
parent 9ec2457147
commit 305d1bce36
3 changed files with 9 additions and 7 deletions

View file

@ -5839,13 +5839,15 @@ static void state_progress_graph(struct snapraid_state* state, struct snapraid_i
int state_progress(struct snapraid_state* state, struct snapraid_io* io, block_off_t blockpos, block_off_t countpos, block_off_t countmax, data_off_t countsize)
{
time_t now;
uint64_t thermal_now;
int pred;
now = time(0);
thermal_now = os_tick_sec();
/* thermal measure */
if (now > state->thermal_latest + THERMAL_PERIOD_SECONDS || state->opt.fake_device) {
state->thermal_latest = now;
if (thermal_now > state->thermal_latest + THERMAL_PERIOD_SECONDS || state->opt.fake_device) {
state->thermal_latest = thermal_now;
state_thermal(state, now);
}