mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
56c91a46b6
commit
9ced3a3a4d
1 changed files with 3 additions and 3 deletions
|
@ -584,15 +584,15 @@ static std::pair<bool, char> 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<HistogramAxisEntry> 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<HistogramAxisEntry> res;
|
||||
|
|
Loading…
Reference in a new issue