    

 ## On this page

  

 

 # clock

 Last update: 16.07.2025 

<a id="l00001" name="l00001"></a> 1 

<a id="l00005" name="l00005"></a> 5 

<a id="l00006" name="l00006"></a> 6\#pragma once

<a id="l00007" name="l00007"></a> 7 

<a id="l00008" name="l00008"></a> 8\#include "core/time/i\_clock/i\_clock.h"

<a id="l00009" name="l00009"></a> 9 

<a id="l00014" name="l00014"></a> 14namespace [simulation\_framework](namespacesimulation__framework.xhtml)

<a id="l00015" name="l00015"></a> 15{

<a id="l00016" name="l00016"></a> 16namespace [core](namespacecore.xhtml)

<a id="l00017" name="l00017"></a> 17{

<a id="l00018" name="l00018"></a> 18namespace [time](namespacetime.xhtml)

<a id="l00019" name="l00019"></a> 19{

<a id="l00020" name="l00020"></a> 20 

<a id="l00022" name="l00022"></a> 22 

<a id="l00027" name="l00027"></a>[ 27](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml)class [Clock](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml) : public [IClock](classsimulation__framework_1_1core_1_1time_1_1IClock.xhtml)

<a id="l00028" name="l00028"></a> 28{

<a id="l00029" name="l00029"></a> 29 public:

<a id="l00030" name="l00030"></a> 30 [Clock](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml)(const milliseconds&amp; [ms](classsimulation__framework_1_1core_1_1Topic.xhtml) = milliseconds(0));

<a id="l00031" name="l00031"></a>[ 31](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#a6742585d7fab0823c46e9008fe2c7400) void [SetNow](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#a6742585d7fab0823c46e9008fe2c7400)(const milliseconds&amp; [ms](classsimulation__framework_1_1core_1_1Topic.xhtml)) override;

<a id="l00032" name="l00032"></a>[ 32](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#ab2bda9ca1779ea42389abd38a29b7202) void [SetNow](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#ab2bda9ca1779ea42389abd38a29b7202)(const Timestamp&amp; timestamp) override;

<a id="l00033" name="l00033"></a>[ 33](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#a42892510ffaad796e1e6944e57b4541b) milliseconds [GetNow](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#a42892510ffaad796e1e6944e57b4541b)() const override;

<a id="l00034" name="l00034"></a>[ 34](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#a1ce05facc1733248af0c7d0126904442) Timestamp [GetNowAsTimestamp](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#a1ce05facc1733248af0c7d0126904442)() const override;

<a id="l00035" name="l00035"></a>[ 35](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#a4b6110fac75c44e37fa2fef35e551fc5) void [IncrementBy](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#a4b6110fac75c44e37fa2fef35e551fc5)(const milliseconds&amp; [ms](classsimulation__framework_1_1core_1_1Topic.xhtml)) override;

<a id="l00036" name="l00036"></a> 36 

<a id="l00037" name="l00037"></a> 37 private:

<a id="l00038" name="l00038"></a> 38 [timepoint&lt;milliseconds&gt;](classsimulation__framework_1_1core_1_1Topic.xhtml) ms_;

<a id="l00039" name="l00039"></a> 39};



<a id="l00040" name="l00040"></a> 40 

<a id="l00041" name="l00041"></a> 41} // namespace time

<a id="l00042" name="l00042"></a> 42} // namespace core

<a id="l00043" name="l00043"></a> 43} // namespace simulation\_framework

[simulation\_framework::core::Topic](classsimulation__framework_1_1core_1_1Topic.xhtml)

This is the concrete Topic class that can be used for creation of a communication channel with given ...

**Definition** [topic.h:38](topic_8h_source.xhtml#l00037)



[simulation\_framework::core::time::Clock](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml)

class IClock

**Definition** [clock.h:28](clock_8h_source.xhtml#l00027)



[simulation\_framework::core::time::Clock::GetNowAsTimestamp](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#a1ce05facc1733248af0c7d0126904442)

Timestamp GetNowAsTimestamp() const override

Gets the current simulation time as a timestamp.



[simulation\_framework::core::time::Clock::GetNow](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#a42892510ffaad796e1e6944e57b4541b)

milliseconds GetNow() const override

Gets the current simulation time in milliseconds.



[simulation\_framework::core::time::Clock::IncrementBy](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#a4b6110fac75c44e37fa2fef35e551fc5)

void IncrementBy(const milliseconds &amp;ms) override

Increments the simulation time by a specified duration.



[simulation\_framework::core::time::Clock::SetNow](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#a6742585d7fab0823c46e9008fe2c7400)

void SetNow(const milliseconds &amp;ms) override

Sets the current simulation time.



[simulation\_framework::core::time::Clock::SetNow](classsimulation__framework_1_1core_1_1time_1_1Clock.xhtml#ab2bda9ca1779ea42389abd38a29b7202)

void SetNow(const Timestamp &amp;timestamp) override

Sets the current simulation time using a timestamp.



[simulation\_framework::core::time::IClock](classsimulation__framework_1_1core_1_1time_1_1IClock.xhtml)

Interface for managing and manipulating simulation time.

**Definition** [i\_clock.h:39](i__clock_8h_source.xhtml#l00038)



[core](namespacecore.xhtml)

The namespace for all core functionalities under namespace simulation_framework.



[simulation\_framework](namespacesimulation__framework.xhtml)

The top namespace for simulation framework.



[time](namespacetime.xhtml)

The namespace for simulation time related implementation under namespace simulation_framework::core.