Skip to content

Commit

Permalink
convert double numbers to int because we expect them to be real ints
Browse files Browse the repository at this point in the history
we give them to APIs expecting int

we compare them to int values

Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien authored and Valdnet committed Jun 12, 2022
1 parent 2a63796 commit 7aa64e8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/gui/userstatusselectormodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,21 +405,21 @@ QString UserStatusSelectorModel::timeDifferenceToString(int differenceSecs) cons
if (differenceSecs < 60) {
return tr("Less than a minute");
} else if (differenceSecs < 60 * 60) {
const auto minutesLeft = std::ceil(differenceSecs / 60.0);
const auto minutesLeft = static_cast<int>(std::ceil(differenceSecs / 60.0));
if (minutesLeft == 1) {
return tr("1 minute");
} else {
return tr("%1 minutes", "", minutesLeft).arg(minutesLeft);
}
} else if (differenceSecs < 60 * 60 * 24) {
const auto hoursLeft = std::ceil(differenceSecs / 60.0 / 60.0);
const auto hoursLeft = static_cast<int>(std::ceil(differenceSecs / 60.0 / 60.0));
if (hoursLeft == 1) {
return tr("1 hour");
} else {
return tr("%1 hours", "", hoursLeft).arg(hoursLeft);
}
} else {
const auto daysLeft = std::ceil(differenceSecs / 60.0 / 60.0 / 24.0);
const auto daysLeft = static_cast<int>(std::ceil(differenceSecs / 60.0 / 60.0 / 24.0));
if (daysLeft == 1) {
return tr("1 day");
} else {
Expand Down

0 comments on commit 7aa64e8

Please sign in to comment.