NRP Core  1.4.1
time_utils.cpp File Reference

Functions

SimulationTime toSimulationTimeFromSeconds (double time)
 Converts floating-point seconds into SimulationTime. More...
 
double getRoundedRunTimeMs (const SimulationTime runTime, const float simulationResolutionMs)
 Calculates simulation run time rounded to milliseconds, accounting for given resolution. More...
 
std::string getTimestamp ()
 returns the current local time as a string in the format: YYMMDD-hhmmss-pid, being pid the pid of the calling process More...
 

Function Documentation

◆ getRoundedRunTimeMs()

double getRoundedRunTimeMs ( const SimulationTime  runTime,
const float  simulationResolutionMs 
)

Calculates simulation run time rounded to milliseconds, accounting for given resolution.

Parameters
runTimeSimulation run time that will be rounded
simulationResolutionMsSimulation resolution in milliseconds
Exceptions
NRPExceptionWhen simulation run time is smaller than simulation resolution
Returns
Rounded simulation run time

◆ getTimestamp()

std::string getTimestamp ( )

returns the current local time as a string in the format: YYMMDD-hhmmss-pid, being pid the pid of the calling process

◆ toSimulationTimeFromSeconds()

SimulationTime toSimulationTimeFromSeconds ( double  time)

Converts floating-point seconds into SimulationTime.

Parameters
timeThe value to be converted
Returns
SimulationTime object that corresponds to the argument