diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed8b864 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +################################################################################ +# This .gitignore file was automatically created by Microsoft(R) Visual Studio. +################################################################################ + +/.vs +/out +/temp diff --git a/src/commands.cpp b/src/commands.cpp index 0a40a57..8bad6ac 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -21,9 +21,11 @@ #include #include #include +#include #include #include #include +#include #include "commands.h" #include "state.h" @@ -497,7 +499,7 @@ bool Wait::RunCommand(const std::string &loopsuffix) { return true; } //cout << "Wait: usleep " << n << endl; - usleep(WAIT_SLEEP_ACCURACY * 1000); + std::this_thread::sleep_for(std::chrono::duration(WAIT_SLEEP_ACCURACY)); if(!closed && TPState::Instance().GetState() == TPState::TERMINATED) { errorstring = "Wait: application terminated"; diff --git a/src/main.cpp b/src/main.cpp index 2b63bce..c8367b1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include "main.h" #include "commands.h" @@ -459,10 +461,8 @@ bool Manager::SendDTMF(const PString &dtmf) // sleep a while std::cout << "sent DTMF: [" << dtmf[i] << "]" << std::endl; - struct timespec tp; - tp.tv_sec = 0; - tp.tv_nsec = 500 * 1000 * 1000; // half a second - nanosleep (&tp, 0); + using namespace std::chrono_literals; + std::this_thread::sleep_for(500ms); } } ok = (i == dtmf.GetSize() - 1 ? true : false);