blob: 8f42623ce36700a68d23781a2f8a4d84e781572c [file] [log] [blame]
#include "aos/common/control_loop/Timing.h"
#include <string.h>
#include "aos/common/logging/logging.h"
#include "aos/common/time.h"
namespace aos {
namespace time {
void PhasedLoopXMS(int ms, int offset) {
// TODO(brians): Tests!
const Time frequency = Time::InMS(ms);
SleepUntil((Time::Now() / static_cast<int32_t>(frequency.ToNSec())) *
static_cast<int32_t>(frequency.ToNSec()) +
frequency + Time::InUS(offset));
}
} // namespace timing
} // namespace aos