Display print end time for in BL device page (#1568)

Show progress increase end time
Supplementary translation

Co-authored-by: ZdDroid <601865048@qq.com>
This commit is contained in:
ZdDroid 2023-07-22 10:40:15 +08:00 committed by GitHub
parent 224e1ea2de
commit 87f6c43784
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 305 additions and 214 deletions

View file

@ -10,6 +10,9 @@
#include <boost/system/error_code.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/date_time.hpp>
#include "boost/date_time/posix_time/ptime.hpp"
#include <openssl/md5.h>
#include "libslic3r.h"
@ -548,6 +551,21 @@ inline std::string get_bbl_monitor_time_dhm(float time_in_secs)
return buffer;
}
inline std::string get_bbl_monitor_end_time_dhm(float time_in_secs)
{
if (time_in_secs == 0.0f)
return {};
std::stringstream stream;
boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
auto endTime = now + boost::posix_time::seconds(static_cast<int>(time_in_secs));
auto facet = new boost::posix_time::time_facet("%H:%M");//%Y-%m-%d %H:%M:%S
stream.imbue(std::locale(std::locale::classic(), facet));
stream << endTime;
return stream.str();
}
inline std::string get_bbl_remain_time_dhms(float time_in_secs)
{
int days = (int) (time_in_secs / 86400.0f);