From e61d416c0e1bbe95179134d30022f391e3000aee Mon Sep 17 00:00:00 2001 From: Costa Tsaousis Date: Wed, 2 Oct 2024 20:00:54 +0300 Subject: [PATCH] Fix win apps uptime (#18662) zero invalid uptime --- src/collectors/apps.plugin/apps_os_windows.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/collectors/apps.plugin/apps_os_windows.c b/src/collectors/apps.plugin/apps_os_windows.c index 38a552bb0dff12..55687280037489 100644 --- a/src/collectors/apps.plugin/apps_os_windows.c +++ b/src/collectors/apps.plugin/apps_os_windows.c @@ -805,6 +805,9 @@ static inline kernel_uint_t perflib_elapsed(COUNTER_DATA *d) { internal_fatal(d->current.CounterType != PERF_ELAPSED_TIME || !freq1, "Wrong gauge type"); + if(!data1 || !time1 || !freq1 || data1 > (ULONGLONG)time1) + return 0; + return (time1 - data1) / freq1; }