File timestamp.h
Last update: 22.04.2026Location: core/time/i_clock/timestamp.h
Classes
Namespaces
Includes
- core/export/simfwk_core_export.h
-
-
-
-
Included by
Source
#ifndef SIMFWK_CORE_TIME_ICLOCK_TIMESTAMP_H
#define SIMFWK_CORE_TIME_ICLOCK_TIMESTAMP_H
#include "core/export/simfwk_core_export.h"
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <string>
namespace simulation_framework
{
namespace core
{
namespace time
{
struct SIMFWK_CORE_API Timestamp
{
uint32_t seconds;
uint32_t nanoseconds;
std::string DebugString() const
{
return "Simulation timestamp: " + std::to_string(seconds) + " second and " + std::to_string(nanoseconds) +
" nanos ";
}
};
inline bool operator==(const Timestamp& lhs, const Timestamp& rhs)
{
return (lhs.seconds == rhs.seconds) && (lhs.nanoseconds == rhs.nanoseconds);
}
inline std::ostream& operator<<(std::ostream& os, const Timestamp& timestamp)
{
double formatted_time = timestamp.seconds + timestamp.nanoseconds * 1e-9;
os << std::right << std::setw(10) << std::fixed << std::setprecision(3) << formatted_time << " s";
return os;
}
} // namespace time
} // namespace core
} // namespace simulation_framework
#endif // SIMFWK_CORE_TIME_ICLOCK_TIMESTAMP_H