13 #if defined(ECL_IS_WIN32) 20 #include "../../include/ecl/time/duration.hpp" 21 #include "../../include/ecl/time/sleep_win.hpp" 35 Sleep::Sleep(
const Duration &duration) {
36 required.tv_sec = duration.sec();
37 required.tv_nsec = duration.nsec();
40 Sleep::Sleep(
const unsigned long &seconds) {
41 required.tv_sec = seconds;
45 void Sleep::operator ()() ecl_assert_throw_decl(StandardException) {
46 TimeError result = sleep(required);
51 required.tv_sec = duration.sec();
52 required.tv_nsec = duration.nsec();
53 TimeError result = sleep(required);
58 required.tv_sec = seconds;
60 TimeError result = sleep(required);
68 MilliSleep::MilliSleep(
const unsigned long &milliseconds) {
69 required.tv_sec = milliseconds/1000;
70 required.tv_nsec = (milliseconds%1000)*1000000;
73 void MilliSleep::operator ()() ecl_assert_throw_decl(StandardException) {
74 TimeError result = sleep(required);
78 void MilliSleep::operator ()(
const unsigned long &milliseconds)
ecl_assert_throw_decl(StandardException) {
79 required.tv_sec = milliseconds/1000;
80 required.tv_nsec = (milliseconds%1000)*1000000;
82 TimeError result = sleep(required);
90 MicroSleep::MicroSleep(
const unsigned long µseconds) {
91 required.tv_sec = microseconds/1000000;
92 required.tv_nsec = (microseconds%1000000)*1000;
95 void MicroSleep::operator ()() ecl_assert_throw_decl(StandardException) {
96 TimeError result = sleep(required);
100 void MicroSleep::operator ()(
const unsigned long µ_seconds)
ecl_assert_throw_decl(StandardException) {
101 required.tv_nsec = 1000*micro_seconds;
102 TimeError result = sleep(required);
110 NanoSleep::NanoSleep(
const unsigned long &nanoseconds) {
111 required.tv_sec = nanoseconds/1000000000;
112 required.tv_nsec = nanoseconds%1000000000;
115 void NanoSleep::operator ()() ecl_assert_throw_decl(StandardException) {
116 TimeError result = sleep(required);
120 void NanoSleep::operator ()(
const unsigned long &nanoseconds)
ecl_assert_throw_decl(StandardException) {
121 required.tv_nsec = nanoseconds;
122 TimeError result = sleep(required);
Embedded control libraries.
#define ecl_assert_throw(expression, exception)
#define ecl_assert_throw_decl(exception)
TimeStamp Duration
Convenience typedef to associate timestamps with the concept of durations.