From: Dave Barach Date: Fri, 27 Dec 2024 17:33:21 +0000 (-0500) Subject: vppinfra: fix time range conversion off-by-1s X-Git-Tag: v25.06-rc0~61 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=d11d31653d948c9f3ac80afd69f111657b007f0f;p=vpp.git vppinfra: fix time range conversion off-by-1s Type: fix Change-Id: I869e657744e9bba81994ad426731a08e5f1bcad7 Signed-off-by: Dave Barach --- diff --git a/src/vppinfra/time_range.c b/src/vppinfra/time_range.c index 54f5629641a..72ed840e7c1 100644 --- a/src/vppinfra/time_range.c +++ b/src/vppinfra/time_range.c @@ -120,7 +120,7 @@ clib_timebase_time_to_components (f64 now, clib_timebase_component_t * cp) now = now - ((f64) days_in_year) * 86400.0; year++; } - while (now > 0.0); + while (now >= 0.0); days_since_epoch -= days_in_year; now += ((f64) days_in_year) * 86400; @@ -138,7 +138,7 @@ clib_timebase_time_to_components (f64 now, clib_timebase_component_t * cp) now = now - ((f64) days_in_month) * 86400.0; month++; } - while (now > 0.0); + while (now >= 0.0); days_since_epoch -= days_in_month; now += ((f64) days_in_month) * 86400; @@ -151,7 +151,7 @@ clib_timebase_time_to_components (f64 now, clib_timebase_component_t * cp) day_of_month++; days_since_epoch++; } - while (now > 0.0); + while (now >= 0.0); day_of_month--; days_since_epoch--;