From 9ced3a3a4df47a3233474c405383dbc4609fca9f Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 20 Oct 2022 16:24:19 +0200 Subject: [PATCH] statistics: fix date ranges smaller than two days The calculation of the range was broken, it resulted in a to-value smaller than the from-value, owing to a sign-mismatch. Signed-off-by: Berthold Stoeger --- stats/statsaxis.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stats/statsaxis.cpp b/stats/statsaxis.cpp index e543b7b25..8e35d96ba 100644 --- a/stats/statsaxis.cpp +++ b/stats/statsaxis.cpp @@ -584,15 +584,15 @@ static std::pair day_format() // create year, month or day-based bins. This is certainly not efficient and may need // some tuning. However, it should ensure that no crazy number of bins is generated. // Ultimately, this should be replaced by a better and dynamic scheme -// From and to are given in seconds since "epoch". +// From and to are given in days since "epoch". static std::vector timeRangeToBins(double from, double to) { // from and two are given in days since the "Unix epoch". // The lowest precision we do is two days. if (to - from < 2.0) { double center = (from + to) / 2.0; - from = center + 1.0; - to = center - 1.0; + from = center - 1.0; + to = center + 1.0; } std::vector res;