35#ifndef ETSI_ITS_MSGS_UTILS_IMPL_CAM_CAM_UTILS_H
36#define ETSI_ITS_MSGS_UTILS_IMPL_CAM_CAM_UTILS_H
46 const TimestampIts& timestamp_estimate) {
48 t_its.value = std::floor(timestamp_estimate.value / 65536) * 65536 + generation_delta_time.value;
49 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX,
"TimestampIts");
62 const GenerationDeltaTime& generation_delta_time,
const TimestampIts& timestamp_estimate,
65 return t_its.value * 1e6 + etsi_its_msgs::UNIX_SECONDS_2004 * 1e9 - n_leap_seconds * 1e9;
76 const GenerationDeltaTime& generation_delta_time,
const uint64_t unix_timestamp_estimate,
uint64_t getUnixNanosecondsFromGenerationDeltaTime(const GenerationDeltaTime &generation_delta_time, const TimestampIts ×tamp_estimate, const uint16_t n_leap_seconds=etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end() ->second)
Get the Unix-Nanoseconds from a given GenerationDeltaTime object.
TimestampIts getTimestampITSFromGenerationDeltaTime(const GenerationDeltaTime &generation_delta_time, const TimestampIts ×tamp_estimate)
Get the TimestampITS from a given GenerationDeltaTime object.
void setTimestampITS(TimestampIts ×tamp_its, const uint64_t unix_nanosecs, const uint16_t n_leap_seconds=etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end() ->second)
Set the TimestampITS object.
Sanity-check functions etc.
void throwIfOutOfRange(const T1 &val, const T2 &min, const T2 &max, const std::string val_desc)
Throws an exception if a given value is out of a defined range.
File containing constants that are used in the context of ETIS ITS Messages.
const std::map< uint64_t, uint16_t > LEAP_SECOND_INSERTIONS_SINCE_2004
std::map that stores all leap second insertions since 2004 with the corresponding unix-date of the in...