Skip to content

Commit

Permalink
Take change of month into account when calculating interval widths
Browse files Browse the repository at this point in the history
- Fixes #135: Task at month end not getting displayed
  • Loading branch information
lauft committed May 19, 2018
1 parent a0569bb commit 543848a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/commands/CmdChart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ static std::string renderTotal (
{
int hours = work / 3600;
int minutes = (work % 3600) / 60;
std::cout << " "
std::cout << " "
<< std::setw (3) << std::setfill (' ') << hours
<< ':'
<< std::setw (2) << std::setfill ('0') << minutes;
Expand Down Expand Up @@ -540,7 +540,7 @@ static void renderInterval (
auto end_mins = (clipped.range.end.hour () - first_hour) * 60 + clipped.range.end.minute ();

if (clipped.range.end.hour () == 0)
end_mins += (clipped.range.end.day() - clipped.range.start.day()) * 24 * 60;
end_mins += (clipped.range.end.day() + (clipped.range.end.month () - clipped.range.start.month () - 1) * clipped.range.start.day ()) * 24 * 60;

work = clipped.range.total ();

Expand Down

0 comments on commit 543848a

Please sign in to comment.