From dd94b34a8d092305f184cf2e5029fd19e91c8296 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 2 Oct 2020 09:30:35 +0200 Subject: [PATCH] Fixed missing include on Linux, printf format string fix boost/format.hpp was missing in the header --- src/slic3r/GUI/GUI_Utils.cpp | 21 +++++++++++++++++++++ src/slic3r/GUI/GUI_Utils.hpp | 20 ++------------------ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/slic3r/GUI/GUI_Utils.cpp b/src/slic3r/GUI/GUI_Utils.cpp index 97e66812a..e2a6ccb88 100644 --- a/src/slic3r/GUI/GUI_Utils.cpp +++ b/src/slic3r/GUI/GUI_Utils.cpp @@ -267,5 +267,26 @@ std::ostream& operator<<(std::ostream &os, const WindowMetrics& metrics) } +TaskTimer::TaskTimer(std::string task_name): + task_name(task_name.empty() ? "task" : task_name) +{ + start_timer = std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()); +} + +TaskTimer::~TaskTimer() +{ + std::chrono::milliseconds stop_timer = std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()); + auto process_duration = std::chrono::milliseconds(stop_timer - start_timer).count(); + std::string out = (boost::format("\n!!! %1% duration = %2% ms \n\n") % task_name % process_duration).str(); + printf("%s", out.c_str()); +#ifdef __WXMSW__ + std::wstring stemp = std::wstring(out.begin(), out.end()); + OutputDebugString(stemp.c_str()); +#endif +} + + } } diff --git a/src/slic3r/GUI/GUI_Utils.hpp b/src/slic3r/GUI/GUI_Utils.hpp index 249ae74f6..edc9fba1f 100644 --- a/src/slic3r/GUI/GUI_Utils.hpp +++ b/src/slic3r/GUI/GUI_Utils.hpp @@ -399,25 +399,9 @@ class TaskTimer std::chrono::milliseconds start_timer; std::string task_name; public: - TaskTimer(std::string task_name): - task_name(task_name.empty() ? "task" : task_name) - { - start_timer = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()); - } + TaskTimer(std::string task_name); - ~TaskTimer() - { - std::chrono::milliseconds stop_timer = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()); - auto process_duration = std::chrono::milliseconds(stop_timer - start_timer).count(); - std::string out = (boost::format("\n!!! %1% duration = %2% ms \n\n") % task_name % process_duration).str(); - printf(out.c_str()); -#ifdef __WXMSW__ - std::wstring stemp = std::wstring(out.begin(), out.end()); - OutputDebugString(stemp.c_str()); -#endif - } + ~TaskTimer(); }; }}