etsi_its_messages v3.4.0
Loading...
Searching...
No Matches
denm_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#ifndef ETSI_ITS_MSGS_UTILS_IMPL_DENM_DENM_UTILS_H
10#define ETSI_ITS_MSGS_UTILS_IMPL_DENM_DENM_UTILS_H
11
13
21inline uint64_t getUnixNanosecondsFromReferenceTime(const TimestampIts& reference_time) {
22 double unix_time_with_leap_seconds = reference_time.value * 1e-3 + etsi_its_msgs::UNIX_SECONDS_2004;
23 uint16_t n_leap_seconds =
24 etsi_its_msgs::getLeapSecondInsertionsSince2004(static_cast<uint64_t>(unix_time_with_leap_seconds));
25 return (unix_time_with_leap_seconds - n_leap_seconds) * 1e9;
26}
27
28#endif // ETSI_ITS_MSGS_UTILS_IMPL_DENM_DENM_UTILS_H
File containing constants that are used in the context of ETIS ITS Messages.
uint16_t getLeapSecondInsertionsSince2004(const uint64_t unix_seconds)
Get the leap second insertions since 2004 for given unix seconds.
Definition constants.h:37
uint64_t getUnixNanosecondsFromReferenceTime(const TimestampIts &reference_time)
Get the Unix-Nanoseconds from a given ReferenceTime object.
Definition denm_utils.h:21