19 namespace localization {
23 template <
class T,
size_t N>
44 static constexpr int32_t LEAP_SECONDS[][2] = {
64 for (
size_t i = 0; i <
ArraySize(LEAP_SECONDS); ++i) {
65 if (unix_seconds >= LEAP_SECONDS[i][0]) {
66 return unix_seconds - (UNIX_GPS_DIFF - LEAP_SECONDS[i][1]);
69 return static_cast<T
>(0);
84 for (
size_t i = 0; i <
ArraySize(LEAP_SECONDS); ++i) {
85 T result = gps_seconds + (UNIX_GPS_DIFF - LEAP_SECONDS[i][1]);
86 if (result >= LEAP_SECONDS[i][0]) {
90 return static_cast<T
>(0);
constexpr size_t ArraySize(T(&)[N])
Definition: time_conversion.h:24
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
constexpr int64_t ONE_MILLION
Definition: time_conversion.h:58
int64_t UnixToGpsMicroSeconds(int64_t unix_microseconds)
Definition: time_conversion.h:72
T GpsToUnixSeconds(T gps_seconds)
Definition: time_conversion.h:83
int64_t GpsToUnixNanoSeconds(int64_t gps_nanoseconds)
Definition: time_conversion.h:98
int64_t GpsToUnixMicroSeconds(int64_t gps_microseconds)
Definition: time_conversion.h:93
int64_t UnixToGpsNanoSeconds(int64_t unix_nanoseconds)
Definition: time_conversion.h:77
T UnixToGpsSeconds(T unix_seconds)
Definition: time_conversion.h:63
constexpr int32_t UNIX_GPS_DIFF
Definition: time_conversion.h:56
constexpr int64_t ONE_BILLION
Definition: time_conversion.h:60