mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
SlicedInfo: Removed secondes from estimated times
This commit is contained in:
parent
d491a38fd7
commit
d81f7d8465
3 changed files with 36 additions and 4 deletions
|
@ -707,6 +707,11 @@ namespace Slic3r {
|
|||
return _get_time_dhms(get_time());
|
||||
}
|
||||
|
||||
std::string GCodeTimeEstimator::get_time_dhm() const
|
||||
{
|
||||
return _get_time_dhm(get_time());
|
||||
}
|
||||
|
||||
std::string GCodeTimeEstimator::get_time_minutes() const
|
||||
{
|
||||
return _get_time_minutes(get_time());
|
||||
|
@ -1616,6 +1621,28 @@ namespace Slic3r {
|
|||
return buffer;
|
||||
}
|
||||
|
||||
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
|
||||
::sprintf(buffer, "%ds", (int)time_in_secs);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
std::string GCodeTimeEstimator::_get_time_minutes(float time_in_secs)
|
||||
{
|
||||
return std::to_string((int)(::roundf(time_in_secs / 60.0f)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue