File timestamp.h
Last update: 09.03.2026Location: core/time/i_clock/timestamp.h
Classes
Namespaces
Includes
Included by
Source
#pragma once
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <string>
namespace simulation_framework
{
namespace core
{
namespace time
{
struct 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