obu-firmware builds against the vanetza-idf C-ITS library, which until now came from the colleague's microbu-esp32c5 tree beside the repository and was not tracked here, so a clone of this repository could not build the firmware it ships. The library alone is now part of obu-firmware, as obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from there by default; -DVANETZA_IDF_DIR still points the build elsewhere. The rest of the colleague's tree (their own VAM firmware, PKI tooling, station-link Python tools, the V2X2MAP bridge) stays out of this repository and gitignored; nothing is pushed to their repository. NOTES.md, docs/06, TODO.md and the pcap verifier's usage line point at the new location.
58 lines
1.6 KiB
C++
58 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <vanetza/common/clock.hpp>
|
|
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
|
#include <boost/optional/optional.hpp>
|
|
#include <chrono>
|
|
#include <string>
|
|
|
|
namespace vanetza
|
|
{
|
|
namespace pki
|
|
{
|
|
|
|
/**
|
|
* Get TAI offset relative to UTC for a particular time point t
|
|
* \param t offset at this time point
|
|
* \return TAI offset in seconds
|
|
*/
|
|
boost::posix_time::time_duration utc_tai_offset(boost::posix_time::ptime t);
|
|
|
|
/**
|
|
* Get current time from system clock, corrected by TAI offset
|
|
*/
|
|
Clock::time_point current_time();
|
|
|
|
/**
|
|
* Parse a human-readable duration into whole hours.
|
|
*
|
|
* Accepted form: "<N><unit>" where N is a non-negative integer and unit is
|
|
* one of:
|
|
* s — seconds (truncated to whole hours)
|
|
* m — minutes (truncated to whole hours)
|
|
* h — hours
|
|
* d — days (24 h)
|
|
* w — weeks (168 h)
|
|
*
|
|
* Returns boost::none on empty input, missing/unknown unit, negative value,
|
|
* unparseable number, or trailing garbage.
|
|
*/
|
|
boost::optional<std::chrono::hours> parse_duration_hours(const std::string&);
|
|
|
|
/**
|
|
* Parse a validity-start specification.
|
|
*
|
|
* Two accepted forms:
|
|
* - Relative: "+<N><unit>" — interpreted as `current_time() + duration`,
|
|
* where the duration follows the same grammar as parse_duration_hours().
|
|
* - Absolute (UTC): an ISO-extended date "YYYY-MM-DD" (00:00:00 implied),
|
|
* or a date+time "YYYY-MM-DDTHH:MM:SS" / "YYYY-MM-DD HH:MM:SS".
|
|
*
|
|
* Returns boost::none on empty input, malformed date, or unrecognised
|
|
* relative duration.
|
|
*/
|
|
boost::optional<Clock::time_point> parse_validity_start(const std::string&);
|
|
|
|
} // namespace pki
|
|
} // namespace vanetza
|