diff --git a/fpsdk_common/LICENSE b/fpsdk_common/LICENSE index a1d9711..4f27604 100644 --- a/fpsdk_common/LICENSE +++ b/fpsdk_common/LICENSE @@ -23,7 +23,7 @@ SOFTWARE. -------------------------------------------------------------------------------- -Parts of fpcommon are based on ROS code (see the source files for details): +Parts of fpsdk_common are based on ROS code (see the source files for details): Copyright (c) 2008, Willow Garage, Inc. All rights reserved. @@ -58,7 +58,7 @@ POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- -Parts of fpcommon are based on NovAtel code: +Parts of fpsdk_common are based on NovAtel code: Copyright (c) 2020 NovAtel Inc. diff --git a/fpsdk_common/include/fpsdk_common/app.hpp b/fpsdk_common/include/fpsdk_common/app.hpp index 66dab6b..e811308 100644 --- a/fpsdk_common/include/fpsdk_common/app.hpp +++ b/fpsdk_common/include/fpsdk_common/app.hpp @@ -228,7 +228,7 @@ class ProgramOptions " -V, --version -- Print program, version and license information, and exit\n" " -v, --verbose -- Increase logging verbosity, multiple flags accumulate\n" " -q, --quiet -- Decrease logging verbosity, multiple flags accumulate\n" - " -J, --journal -- Use systemd journal logging markers instead of colours\n"; // clang-format on + " -J, --journal -- Use systemd journal logging markers instead of colours (default: auto)\n"; // clang-format on std::string app_name_; //!< App name logging::LoggingParams logging_params_; //!< Logging params diff --git a/fpsdk_common/include/fpsdk_common/parser/types.hpp b/fpsdk_common/include/fpsdk_common/parser/types.hpp index a5c3710..54e4075 100644 --- a/fpsdk_common/include/fpsdk_common/parser/types.hpp +++ b/fpsdk_common/include/fpsdk_common/parser/types.hpp @@ -142,7 +142,7 @@ struct ParserMsg */ struct ParserStats { - uint64_t n_msgs_ = 0; //!< Number of messages parsed + uint64_t n_msgs_ = 0; //!< Total number of messages parsed uint64_t s_msgs_ = 0; //!< Total size of messages parsed uint64_t n_fpa_ = 0; //!< Number of Protocol::FP_A messages uint64_t s_fpa_ = 0; //!< Total size of Protocol::FP_A messages diff --git a/fpsdk_common/include/fpsdk_common/to_json/parser.hpp b/fpsdk_common/include/fpsdk_common/to_json/parser.hpp index 39e4ac9..825f34e 100644 --- a/fpsdk_common/include/fpsdk_common/to_json/parser.hpp +++ b/fpsdk_common/include/fpsdk_common/to_json/parser.hpp @@ -47,6 +47,38 @@ inline void to_json(nlohmann::json& j, const ParserMsg& m) } } +// --------------------------------------------------------------------------------------------------------------------- + +inline void to_json(nlohmann::json& j, const ParserStats s) +{ + j = nlohmann::json::object({ + { "n_msgs", s.n_msgs_ }, + { "s_msgs", s.s_msgs_ }, + { "n_fpa", s.n_fpa_ }, + { "s_fpa", s.s_fpa_ }, + { "n_fpb", s.n_fpb_ }, + { "s_fpb", s.s_fpb_ }, + { "n_nmea", s.n_nmea_ }, + { "s_nmea", s.s_nmea_ }, + { "n_ubx", s.n_ubx_ }, + { "s_ubx", s.s_ubx_ }, + { "n_rtcm3", s.n_rtcm3_ }, + { "s_rtcm3", s.s_rtcm3_ }, + { "n_unib", s.n_unib_ }, + { "s_unib", s.s_unib_ }, + { "n_novb", s.n_novb_ }, + { "s_novb", s.s_novb_ }, + { "n_sbf", s.n_sbf_ }, + { "s_sbf", s.s_sbf_ }, + { "n_qgc", s.n_qgc_ }, + { "s_qgc", s.s_qgc_ }, + { "n_spartn", s.n_spartn_ }, + { "s_spartn", s.s_spartn_ }, + { "n_other", s.n_other_ }, + { "s_other", s.s_other_ }, + }); +} + } // namespace fpsdk::common::parser /* ****************************************************************************************************************** */ #endif // !_DOXYGEN_ diff --git a/fpsdk_common/src/logging.cpp b/fpsdk_common/src/logging.cpp index de2d101..ac72237 100644 --- a/fpsdk_common/src/logging.cpp +++ b/fpsdk_common/src/logging.cpp @@ -193,6 +193,7 @@ void LoggingDefaultWriteFn(const LoggingParams& params, const LoggingLevel level } } + // Colours come after the timestamp (unlike the journal markers, see above) if ((params.colour_ != LoggingColour::JOURNAL) && (prefix != NULL)) { len += std::snprintf(&output[len], sizeof(output) - len, "%s", prefix); } @@ -250,9 +251,10 @@ LoggingParams::LoggingParams( s_defaults_init = true; } - // User wants us to decide... + // User wants us to decide. INVOCATION_ID is set by systemd and part of every unit's environment. if (colour_ == LoggingColour::AUTO) { - colour_ = (isatty(fileno(stderr)) == 1 ? LoggingColour::YES : LoggingColour::NO); + colour_ = (isatty(fileno(stderr)) == 1 ? LoggingColour::YES : // clang-format off + (std::getenv("INVOCATION_ID") != nullptr ? LoggingColour::JOURNAL : LoggingColour::NO)); // clang-format on } } diff --git a/fpsdk_common/src/parser.cpp b/fpsdk_common/src/parser.cpp index 62b91e2..9f99736 100644 --- a/fpsdk_common/src/parser.cpp +++ b/fpsdk_common/src/parser.cpp @@ -66,7 +66,7 @@ void Parser::Reset() { size_ = 0; offs_ = 0; - stats_ = ParserStats(); + stats_ = {}; } // --------------------------------------------------------------------------------------------------------------------- diff --git a/fpsdk_common/src/time.cpp b/fpsdk_common/src/time.cpp index 129bcc9..02c252b 100644 --- a/fpsdk_common/src/time.cpp +++ b/fpsdk_common/src/time.cpp @@ -748,11 +748,11 @@ static constexpr int TAI_OFFS = 10; // offset of CLOCK_TAI to our atomic time // TODO: consider making some CI that uses the IERS bulletins or https://data.iana.org/time-zones/data/leap-seconds.list // to check, and possibly update, this table. -// See IERS "Bulletin C" #70 July 2025 (https://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat) +// See IERS "Bulletin C" #71 January 2026 (https://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat) // See also https://data.iana.org/time-zones/data/leap-seconds.list // See also /usr/share/zoneinfo/{leapseconds,leap-seconds.list} // The earliest time there can be a change is approximately: -static constexpr uint32_t max_ts = 1782820800; // TZ=UTC date --date "2026-06-30 12:00:00" +%s +static constexpr uint32_t max_ts = 1798718400; // TZ=UTC date --date "2026-12-31 12:00:00" +%s static constexpr uint32_t NUM_LEAPS = 27; static constexpr std::array, NUM_LEAPS> LEAPSECONDS = { { // clang-format off