Loading src/arch/posix/arch.cc +17 −0 Original line number Diff line number Diff line #include "arch.h" #include <time.h> #include <unistd.h> #if defined(WITH_LOOP) || defined(TIMER_S) Loading Loading @@ -31,4 +32,20 @@ void Arch::idle(void) { } void Arch::delay_us(unsigned int const us) { struct timespec ts; ts.tv_sec = 0; ts.tv_nsec = us * 1000; nanosleep(&ts, NULL); } void Arch::delay_ms(unsigned int const ms) { struct timespec ts; ts.tv_sec = ms / 1000; ts.tv_nsec = (ms % 1000) * 1000000; nanosleep(&ts, NULL); } Arch arch; Loading
src/arch/posix/arch.cc +17 −0 Original line number Diff line number Diff line #include "arch.h" #include <time.h> #include <unistd.h> #if defined(WITH_LOOP) || defined(TIMER_S) Loading Loading @@ -31,4 +32,20 @@ void Arch::idle(void) { } void Arch::delay_us(unsigned int const us) { struct timespec ts; ts.tv_sec = 0; ts.tv_nsec = us * 1000; nanosleep(&ts, NULL); } void Arch::delay_ms(unsigned int const ms) { struct timespec ts; ts.tv_sec = ms / 1000; ts.tv_nsec = (ms % 1000) * 1000000; nanosleep(&ts, NULL); } Arch arch;