Fix win apps uptime (#18662)
zero invalid uptime
Costa Tsaousis committed
Oct 2, 2024 at 20:00 UTC
e61d416c0e1bbe95179134d30022f391e3000aee
1 file changed
+3
src/collectors/apps.plugin/apps_os_windows.c
+3
@@ -805,6 +805,9 @@ static inline kernel_uint_t perflib_elapsed(COUNTER_DATA *d) {
805
internal_fatal(d->current.CounterType != PERF_ELAPSED_TIME || !freq1,
806
"Wrong gauge type");
807
808
+ if(!data1 || !time1 || !freq1 || data1 > (ULONGLONG)time1)
809
+ return 0;
810
+
811
return (time1 - data1) / freq1;
812
}
813