From ad4f3dcedab29a690c5eedbb08ba1b393917db0b Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期三, 21 四月 2021 17:39:34 +0800 Subject: [PATCH] update go api. --- utest/util.h | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/utest/util.h b/utest/util.h index aaa5189..4d960db 100644 --- a/utest/util.h +++ b/utest/util.h @@ -34,10 +34,18 @@ #include <vector> using namespace boost::posix_time; -inline ptime Now() { return second_clock::universal_time(); }; using namespace std::chrono_literals; +template <class D> +inline void Sleep(D d, bool print = true) +{ + if (print) { + printf("sleep for %ld ms\n", std::chrono::duration_cast<std::chrono::milliseconds>(d).count()); + } + std::this_thread::sleep_for(d); +} + typedef std::function<void(void)> FuncVV; class ScopeCall : private boost::noncopyable -- Gitblit v1.8.0