previous_total = total;
previous_idle = cpu_active[IDLE_NUM];
- percent = ((uintmax_t)TICKZ * (diff_total - diff_idle)) / diff_total;
+ percent = 0;
+ if (0 != diff_total) {
+ percent = ((uintmax_t)TICKZ * (diff_total - diff_idle)) / diff_total;
+ }
FILL_UINT_ARR(str1, percent);
}
previous_total[x] = total[x];
previous_idle[x] = core_active[x][IDLE_NUM];
- percent[x] = ((uintmax_t)TICKZ * (diff_total[x] - diff_idle[x]))
+ percent[x] = 0;
+ if (0 != diff_total[x]) {
+ percent[x] = ((uintmax_t)TICKZ * (diff_total[x] - diff_idle[x]))
/ diff_total[x];
+ }
GLUE2(all, FMT_UINT"%% ", percent[x]);
}
FILL_UINT_ARR(str1, temp2 / 1000);
} else {
FILL_UINT_ARR(str1, ((999 < temp2) ?
- temp2 / 100 : temp2/10)); /* > 9C || < 9C */
+ temp2 / 100 : temp2 / 10)); /* > 9C || < 9C */
}
}
OPEN_X(fp, temp, FMT_UINT, &used);
#pragma GCC diagnostic pop
- percent = (used * 100) / total;
+ percent = 0;
+ if (0 != total) {
+ percent = (used * 100) / total;
+ }
FILL_UINT_ARR(str1, percent);
}
}
snd_mixer_selem_get_playback_volume_range(elem, &min, &max);
- percent = (vol * 100) / max;
+ percent = 0L;
+ if (0 != max) {
+ percent = (vol * 100) / max;
+ }
snd_mixer_selem_id_free(s_elem);
snd_mixer_close(handle);