Fix chrono

This commit is contained in:
Sergey Kovalev 2021-11-24 00:18:55 +07:00
parent fbe90b5534
commit a0f0f329c8
2 changed files with 12 additions and 12 deletions

View File

@ -158,18 +158,18 @@ namespace Slic3r {
} }
} }
void TCPConsole::set_deadline_in(boost::chrono::steady_clock::duration d) void TCPConsole::set_deadline_in(std::chrono::steady_clock::duration d)
{ {
deadline_ = boost::chrono::steady_clock::now() + d; deadline_ = std::chrono::steady_clock::now() + d;
} }
bool TCPConsole::is_deadline_over() bool TCPConsole::is_deadline_over()
{ {
return deadline_ < boost::chrono::steady_clock::now(); return deadline_ < std::chrono::steady_clock::now();
} }
bool TCPConsole::run_queue() bool TCPConsole::run_queue()
{ {
auto now = boost::chrono::steady_clock::now(); auto now = std::chrono::steady_clock::now();
try { try {
// TODO: Add more resets and initializations after previous run (reset() method?..) // TODO: Add more resets and initializations after previous run (reset() method?..)
set_deadline_in(connect_timeout_); set_deadline_in(connect_timeout_);

View File

@ -24,9 +24,9 @@ namespace Slic3r {
{ {
newline_ = "\n"; newline_ = "\n";
done_string_ = "ok"; done_string_ = "ok";
connect_timeout_ = boost::chrono::milliseconds(5000); connect_timeout_ = std::chrono::milliseconds(5000);
write_timeout_ = boost::chrono::milliseconds(10000); write_timeout_ = std::chrono::milliseconds(10000);
read_timeout_ = boost::chrono::milliseconds(10000); read_timeout_ = std::chrono::milliseconds(10000);
} }
void set_line_delimiter(const std::string& newline) { void set_line_delimiter(const std::string& newline) {
@ -62,16 +62,16 @@ namespace Slic3r {
void wait_next_line(); void wait_next_line();
std::string extract_next_line(); std::string extract_next_line();
void set_deadline_in(boost::chrono::steady_clock::duration); void set_deadline_in(std::chrono::steady_clock::duration);
bool is_deadline_over(); bool is_deadline_over();
std::string host_name_; std::string host_name_;
std::string port_name_; std::string port_name_;
std::string newline_; std::string newline_;
std::string done_string_; std::string done_string_;
boost::chrono::steady_clock::duration connect_timeout_; std::chrono::steady_clock::duration connect_timeout_;
boost::chrono::steady_clock::duration write_timeout_; std::chrono::steady_clock::duration write_timeout_;
boost::chrono::steady_clock::duration read_timeout_; std::chrono::steady_clock::duration read_timeout_;
std::list<std::string> cmd_queue_; std::list<std::string> cmd_queue_;
@ -83,7 +83,7 @@ namespace Slic3r {
bool is_connected_; bool is_connected_;
boost::system::error_code error_code_; boost::system::error_code error_code_;
boost::chrono::steady_clock::time_point deadline_; std::chrono::steady_clock::time_point deadline_;
}; };
} // Utils } // Utils