Goby3 3.6.1
2026.09.15
Loading...
Searching...
No Matches
simulation_time.h
Go to the documentation of this file.
1// Copyright 2026:
2// GobySoft, LLC (2013-)
3// Community contributors (see AUTHORS file)
4// File authors:
5// Toby Schneider <toby@gobysoft.org>
6//
7//
8// This file is part of the Goby Underwater Autonomy Project Libraries
9// ("The Goby Libraries").
10//
11// The Goby Libraries are free software: you can redistribute them and/or modify
12// them under the terms of the GNU Lesser General Public License as published by
13// the Free Software Foundation, either version 2.1 of the License, or
14// (at your option) any later version.
15//
16// The Goby Libraries are distributed in the hope that they will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Lesser General Public License for more details.
20//
21// You should have received a copy of the GNU Lesser General Public License
22// along with Goby. If not, see <http://www.gnu.org/licenses/>.
23
24#ifndef GOBY_MIDDLEWARE_APPLICATION_DETAIL_SIMULATION_TIME_H
25#define GOBY_MIDDLEWARE_APPLICATION_DETAIL_SIMULATION_TIME_H
26
27#include <chrono> // for microseconds, system_clock
28
29#include "goby/middleware/protobuf/app_config.pb.h" // for AppConfig
30#include "goby/time/simulation.h" // for SimulatorSettings
31
32namespace goby
33{
34namespace middleware
35{
36namespace detail
37{
46{
47 if (!app_cfg.simulation().time().use_sim_time())
48 return;
49
52
53 if (app_cfg.simulation().time().has_reference_microtime())
54 goby::time::SimulatorSettings::reference_time = std::chrono::system_clock::time_point(
55 std::chrono::microseconds(app_cfg.simulation().time().reference_microtime()));
56}
57
58} // namespace detail
59} // namespace middleware
60} // namespace goby
61
62#endif
const ::goby::middleware::protobuf::AppConfig_SimulatorSettings_Time & time() const
const ::goby::middleware::protobuf::AppConfig_SimulatorSettings & simulation() const
detail namespace with internal helper functions
Definition json.hpp:263
void configure_simulation_time(const protobuf::AppConfig &app_cfg)
Applies the simulation time settings from an application configuration to goby::time::SimulatorSettin...
The global namespace for the Goby project.
static bool using_sim_time
Enables simulation time if true (if false, none of the remaining parameters are used)
Definition simulation.h:38
static std::chrono::system_clock::time_point reference_time
Reference time when calculating SystemClock::now(). If this is unset, the default is 1 January of the...
Definition simulation.h:42
static int warp_factor
Warp factor to speed up (or slow time) the time values returned by SteadyClock::now() and SystemClock...
Definition simulation.h:40