Class simulation_framework::core::time::Clock
Last update: 22.04.2026
Definition: core/time/clock/clock.h (line 29)
class IClock
Implementation of IClock interface to manipulate time.
Interface for managing and manipulating simulation time.
The IClock class provides a generic interface for handling simulation time. It allows setting the current simulation time, retrieving it in different formats, and incrementing time by a specified duration.
This interface is particularly useful in simulations where time needs to be controlled programmatically rather than relying on real-world time progression.
Inherits from:
Members
Public functions
Function Clock
simulation_framework::core::time::Clock::Clock(const milliseconds &ms=milliseconds(0))
Parameters:
- const milliseconds & ms = milliseconds(0)
Return type:
Function SetNow
void simulation_framework::core::time::Clock::SetNow(const milliseconds &ms) override
Sets the current simulation time.
This method allows setting the simulation's current time to a specific duration from the epoch (0 milliseconds).
Parameters:
- ms: The time to set, represented as milliseconds from the epoch.
Parameters:
- const milliseconds & ms
Return type: void
Reimplements: SetNow
Function SetNow
void simulation_framework::core::time::Clock::SetNow(const Timestamp ×tamp) override
Sets the current simulation time using a timestamp.
This method sets the simulation's current time to a specific point in time, represented as a Timestamp object.
Parameters:
- timestamp: The point in time to set as the current simulation time.
Parameters:
- const Timestamp & timestamp
Return type: void
Reimplements: SetNow
Function GetNow
milliseconds simulation_framework::core::time::Clock::GetNow() const override
Gets the current simulation time in milliseconds.
This method returns the current simulation time as a duration measured in milliseconds since the epoch (0 milliseconds).
Returns:
The current simulation time as a milliseconds object.
Return type: milliseconds
Reimplements: GetNow
Function GetNowAsTimestamp
Timestamp simulation_framework::core::time::Clock::GetNowAsTimestamp() const override
Gets the current simulation time as a timestamp.
This method returns the current simulation time as a Timestamp object, providing a more precise representation of the current point in time.
Returns:
The current simulation time as a Timestamp object.
Return type: Timestamp
Reimplements: GetNowAsTimestamp
Function IncrementBy
void simulation_framework::core::time::Clock::IncrementBy(const milliseconds &ms) override
Increments the simulation time by a specified duration.
This method adds the given duration (in milliseconds) to the current simulation time. It is useful for progressing the simulation clock in a controlled manner.
Parameters:
- ms: The duration to add to the current simulation time.
Parameters:
- const milliseconds & ms
Return type: void
Reimplements: IncrementBy