diff --git a/qse/include/qse/cmn/time.h b/qse/include/qse/cmn/time.h index ec286ea0..28a75fca 100644 --- a/qse/include/qse/cmn/time.h +++ b/qse/include/qse/cmn/time.h @@ -129,7 +129,7 @@ struct qse_btime_t static QSE_INLINE void qse_cleartime(qse_ntime_t* x) { qse_inittime (x, 0, 0); } /*static QSE_INLINE int qse_cmptime(qse_ntime_t* x, qse_ntime_t* y) { - /* TODO: fix the type and value range issue and replace the macro below. + // TODO: fix the type and value range issue and replace the macro below. return (x->sec == y->sec)? (x->nsec - y->nsec): (x->sec - y->sec); }*/ # define qse_cmptime(x,y) (((x)->sec == (y)->sec)? ((x)->nsec - (y)->nsec): ((x)->sec - (y)->sec)) diff --git a/qse/include/qse/si/App.hpp b/qse/include/qse/si/App.hpp index 0789ffd3..4032c2bd 100644 --- a/qse/include/qse/si/App.hpp +++ b/qse/include/qse/si/App.hpp @@ -31,6 +31,7 @@ #include #include #include +#include ///////////////////////////////// QSE_BEGIN_NAMESPACE(QSE) @@ -56,6 +57,9 @@ public: int chroot (const qse_mchar_t* mpath) QSE_CPP_NOEXCEPT; int chroot (const qse_wchar_t* wpath) QSE_CPP_NOEXCEPT; + void sleep (const qse_ntime_t* duration) QSE_CPP_NOEXCEPT; + void sleep (unsigned int seconds) QSE_CPP_NOEXCEPT; + #if 0 int switchUser (qse_uid_t uid, qse_gid_t gid, bool permanently) QSE_CPP_NOEXCEPT; int restoreUser () QSE_CPP_NOEXCEPT; diff --git a/qse/lib/si/App.cpp b/qse/lib/si/App.cpp index bc6bfd79..3c14a2ea 100644 --- a/qse/lib/si/App.cpp +++ b/qse/lib/si/App.cpp @@ -27,9 +27,11 @@ #include #include #include +#include #include "../cmn/syscall.h" #include + ///////////////////////////////// QSE_BEGIN_NAMESPACE(QSE) ///////////////////////////////// @@ -190,6 +192,17 @@ int App::chroot (const qse_wchar_t* wpath) QSE_CPP_NOEXCEPT return n; } +void App::sleep (const qse_ntime_t* duration) QSE_CPP_NOEXCEPT +{ + qse_sleep (duration); +} + +void App::sleep (unsigned int seconds) QSE_CPP_NOEXCEPT +{ + static qse_ntime_t duration = { seconds, 0 }; + qse_sleep (&duration); +} + #if 0 int App::switchPrivilege (int gid, int uid, bool permanently) {