etsi_its_messages
v3.4.0
Loading...
Searching...
No Matches
cpm_ts_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
#pragma once
10
18
inline
uint64_t
getUnixNanosecondsFromReferenceTime
(
const
TimestampIts& reference_time) {
19
double
unix_time_with_leap_seconds = reference_time.value * 1e-3 + etsi_its_msgs::UNIX_SECONDS_2004;
20
uint16_t n_leap_seconds =
21
etsi_its_msgs::getLeapSecondInsertionsSince2004
(
static_cast<
uint64_t
>
(unix_time_with_leap_seconds));
22
return
(unix_time_with_leap_seconds - n_leap_seconds) * 1e9;
23
}
etsi_its_msgs::getLeapSecondInsertionsSince2004
uint16_t getLeapSecondInsertionsSince2004(const uint64_t unix_seconds)
Get the leap second insertions since 2004 for given unix seconds.
Definition
constants.h:37
getUnixNanosecondsFromReferenceTime
uint64_t getUnixNanosecondsFromReferenceTime(const TimestampIts &reference_time)
Get the Unix-Nanoseconds from a given ReferenceTime object.
Definition
cpm_ts_utils.h:18
etsi_its_msgs_utils
include
etsi_its_msgs_utils
impl
cpm
cpm_ts_utils.h
Generated by
1.16.1