vppinfra: fix time range conversion off-by-1s 78/42078/3
authorDave Barach <dave@barachs.net>
Fri, 27 Dec 2024 17:33:21 +0000 (12:33 -0500)
committerDave Barach <vpp@barachs.net>
Fri, 27 Dec 2024 18:02:20 +0000 (18:02 +0000)
Type: fix

Change-Id: I869e657744e9bba81994ad426731a08e5f1bcad7
Signed-off-by: Dave Barach <dave@barachs.net>
src/vppinfra/time_range.c

index 54f5629..72ed840 100644 (file)
@@ -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--;