etsi_its_messages
v3.5.0
Toggle main menu visibility
Loading...
Searching...
No Matches
mcm_utils.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright Institute for Automotive Engineering (ika), RWTH Aachen University
3
8
9
#include <
etsi_its_msgs_utils/impl/checks.h
>
10
#include <
etsi_its_msgs_utils/impl/constants.h
>
11
12
#ifndef ETSI_ITS_MSGS_UTILS_IMPL_MCM_MCM_UTILS_H
13
#define ETSI_ITS_MSGS_UTILS_IMPL_MCM_MCM_UTILS_H
14
23
inline
uint64_t
getUnixNanosecondsFromGenerationDeltaTime
(
24
const
GenerationDeltaTime& generation_delta_time,
const
uint64_t unix_timestamp_estimate,
25
const
uint16_t n_leap_seconds =
etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004
.rbegin()->second) {
26
uint64_t ms_estimate_after_utc_2004 =
27
unix_timestamp_estimate * 1e-6 + (uint64_t)(n_leap_seconds * 1e3) - etsi_its_msgs::UNIX_SECONDS_2004 * 1e3;
28
uint64_t ms_after_utc_2004 = std::floor(ms_estimate_after_utc_2004 / 65536) * 65536 + generation_delta_time.value;
29
return
ms_after_utc_2004 * 1e6 + etsi_its_msgs::UNIX_SECONDS_2004 * 1e9 - n_leap_seconds * 1e9;
30
}
31
32
#endif
// ETSI_ITS_MSGS_UTILS_IMPL_MCM_MCM_UTILS_H
checks.h
Sanity-check functions etc.
constants.h
File containing constants that are used in the context of ETIS ITS Messages.
etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004
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...
Definition
constants.h:22
getUnixNanosecondsFromGenerationDeltaTime
uint64_t getUnixNanosecondsFromGenerationDeltaTime(const GenerationDeltaTime &generation_delta_time, const uint64_t unix_timestamp_estimate, const uint16_t n_leap_seconds=etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.rbegin() ->second)
Get the Unix Nanoseconds from Generation Delta Time object.
Definition
mcm_utils.h:23
etsi_its_msgs_utils
include
etsi_its_msgs_utils
impl
mcm
mcm_utils.h
Generated by
1.17.0