imageinfo_ni: avoid division by zero

Origin commit data
------------------
Branch: ni/coolstream
Commit: bad49da359
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2021-11-07 (Sun, 07 Nov 2021)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2021-11-07 14:41:13 +01:00
parent 795ae2c4a0
commit 600a33eb26

View File

@@ -549,7 +549,8 @@ int CImageInfoNI::CPU_Percent(_stat *cpu)
long unsigned int sys_diff = sys_new - sys_old;
long unsigned int total_diff = total_new - total_old;
if(!total_diff)
total_diff = 1;
long unsigned int percent = ((float) sys_diff / (float) total_diff) * 100;
if (sys_diff > 1 || total_diff > 1)