Fix of d81f7d8465
(SlicedInfo: Removed secondes from estimated times): GCodeTimeEstimator::_get_time_dhm() shall round to minutes, old code rounded down to minutes, new code rounds to 1/2.
This commit is contained in:
parent
bfbf3ac94d
commit
a25f58731e
@ -1623,22 +1623,23 @@ namespace Slic3r {
|
||||
|
||||
std::string GCodeTimeEstimator::_get_time_dhm(float time_in_secs)
|
||||
{
|
||||
int days = (int)(time_in_secs / 86400.0f);
|
||||
time_in_secs -= (float)days * 86400.0f;
|
||||
int hours = (int)(time_in_secs / 3600.0f);
|
||||
time_in_secs -= (float)hours * 3600.0f;
|
||||
int minutes = (int)(time_in_secs / 60.0f);
|
||||
time_in_secs -= (float)minutes * 60.0f;
|
||||
|
||||
char buffer[64];
|
||||
if (days > 0)
|
||||
::sprintf(buffer, "%dd %dh %dm", days, hours, minutes);
|
||||
else if (hours > 0)
|
||||
::sprintf(buffer, "%dh %dm", hours, minutes);
|
||||
else if (minutes > 0)
|
||||
::sprintf(buffer, "%dm", minutes);
|
||||
else
|
||||
|
||||
int minutes = std::round(time_in_secs / 60.);
|
||||
if (minutes <= 0) {
|
||||
::sprintf(buffer, "%ds", (int)time_in_secs);
|
||||
} else {
|
||||
int days = minutes / 1440;
|
||||
minutes -= days * 1440;
|
||||
int hours = minutes / 60;
|
||||
minutes -= hours * 60;
|
||||
if (days > 0)
|
||||
::sprintf(buffer, "%dd %dh %dm", days, hours, minutes);
|
||||
else if (hours > 0)
|
||||
::sprintf(buffer, "%dh %dm", hours, minutes);
|
||||
else
|
||||
::sprintf(buffer, "%dm", minutes);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user