24 #include <utils/time/clock.h>
25 #include <utils/time/time.h>
26 #include <utils/time/wait.h>
51 desired_loop_time_ = desired_loop_time_usec;
54 until_systime_ =
new Time();
62 delete until_systime_;
71 *until_ += desired_loop_time_;
73 *until_systime_ += desired_loop_time_;
84 long int remaining_usec = (*until_ - *now_).in_usec();
85 while (remaining_usec > 0) {
86 usleep(remaining_usec);
88 remaining_usec = (*until_ - *now_).in_usec();
102 long int remaining_usec = (*until_systime_ - *now_).in_usec();
103 while (remaining_usec > 0) {
104 usleep(remaining_usec);
106 remaining_usec = (*until_systime_ - *now_).in_usec();
121 struct timeval start, now;
122 long int remaining_usec = usec;
123 gettimeofday(&start, NULL);
125 usleep(remaining_usec);
126 gettimeofday(&now, NULL);
127 }
while ((remaining_usec = usec -
time_diff_usec(now, start)) > 0);
144 struct timeval start, now;
145 long int remaining_usec = usec;
148 usleep(remaining_usec);
150 }
while ((remaining_usec = usec -
time_diff_usec(now, start)) > 0);