|
|
@ -5,20 +5,13 @@ |
|
|
|
#include <string> |
|
|
|
#include <string> |
|
|
|
#include <vector> |
|
|
|
#include <vector> |
|
|
|
#include <utility> |
|
|
|
#include <utility> |
|
|
|
#include <time.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <capnp/serialize.h> |
|
|
|
#include <capnp/serialize.h> |
|
|
|
|
|
|
|
|
|
|
|
#include "cereal/gen/cpp/log.capnp.h" |
|
|
|
#include "cereal/gen/cpp/log.capnp.h" |
|
|
|
|
|
|
|
#include "common/timing.h" |
|
|
|
#include "msgq/ipc.h" |
|
|
|
#include "msgq/ipc.h" |
|
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__ |
|
|
|
|
|
|
|
#define CLOCK_BOOTTIME CLOCK_MONOTONIC |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MSG_MULTIPLE_PUBLISHERS 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SubMaster { |
|
|
|
class SubMaster { |
|
|
|
public: |
|
|
|
public: |
|
|
|
SubMaster(const std::vector<const char *> &service_list, const std::vector<const char *> &poll = {}, |
|
|
|
SubMaster(const std::vector<const char *> &service_list, const std::vector<const char *> &poll = {}, |
|
|
@ -53,10 +46,7 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
cereal::Event::Builder initEvent(bool valid = true) { |
|
|
|
cereal::Event::Builder initEvent(bool valid = true) { |
|
|
|
cereal::Event::Builder event = initRoot<cereal::Event>(); |
|
|
|
cereal::Event::Builder event = initRoot<cereal::Event>(); |
|
|
|
struct timespec t; |
|
|
|
event.setLogMonoTime(nanos_since_boot()); |
|
|
|
clock_gettime(CLOCK_BOOTTIME, &t); |
|
|
|
|
|
|
|
uint64_t current_time = t.tv_sec * 1000000000ULL + t.tv_nsec; |
|
|
|
|
|
|
|
event.setLogMonoTime(current_time); |
|
|
|
|
|
|
|
event.setValid(valid); |
|
|
|
event.setValid(valid); |
|
|
|
return event; |
|
|
|
return event; |
|
|
|
} |
|
|
|
} |
|
|
|