From d11d31653d948c9f3ac80afd69f111657b007f0f Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Fri, 27 Dec 2024 12:33:21 -0500 Subject: vppinfra: fix time range conversion off-by-1s Type: fix Change-Id: I869e657744e9bba81994ad426731a08e5f1bcad7 Signed-off-by: Dave Barach --- src/vppinfra/time_range.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/vppinfra/time_range.c') 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--; -- cgit