File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -193,8 +193,14 @@ void Simulator::advanceEpoch(int currentEpoch) const
193193 while (g_simulationStep < endStep) {
194194 // Output status once every 1% of total simulation time
195195 if (count % onePercent == 0 ) {
196+ // Simulation time is calculated independently to handle deserialization scenarios.
197+ // If g_simulationStep is set to a value greater than totalDuration after deserialization,
198+ // a modulo operation is applied to ensure the displayed simulation time is accurate.
199+ // If totalDuration is zero, the entire simulation time is determined by g_simulationStep * deltaT_.
196200 uint64_t totalDuration = (epochDuration_ * numEpochs_) - 1 ;
197- uint64_t simulatedTime = (uint64_t )(g_simulationStep * deltaT_) % totalDuration;
201+ auto simulatedTime
202+ = (totalDuration == 0 ? (g_simulationStep * deltaT_)
203+ : (uint64_t )(g_simulationStep * deltaT_) % totalDuration);
198204
199205 LOG4CPLUS_TRACE (consoleLogger_, " Epoch: " << currentEpoch << " /" << numEpochs_
200206 << " simulating time: " << simulatedTime << " /"
You can’t perform that action at this time.
0 commit comments