File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,15 +75,15 @@ void DriftingOscillatorBase::setDriftRate(ppm newDriftRate)
7575 emit (preOscillatorStateChangedSignal, this );
7676 simtime_t currentSimTime = simTime ();
7777 EV_INFO << " Setting oscillator drift rate from " << driftRate << " to " << newDriftRate << " at simtime " << currentSimTime << " .\n " ;
78- simtime_t currentTickLength = getCurrentTickLength ();
79- simtime_t baseTickTime = origin + nextTickFromOrigin - currentTickLength;
80- simtime_t elapsedTickTime = fmod (currentSimTime - baseTickTime, currentTickLength);
8178 if (elapsedTickTime == SIMTIME_ZERO )
8279 nextTickFromOrigin = 0 ;
8380 else {
8481 int64_t v = increaseWithDriftRate (currentTickLength.raw () - elapsedTickTime.raw ());
8582 nextTickFromOrigin = SimTime::fromRaw (decreaseWithDriftRate (v, newInverseDriftRate));
8683 }
84+ simtime_t oldCurrentTickLength = getCurrentTickLength ();
85+ simtime_t baseTickTime = origin + nextTickFromOrigin - oldCurrentTickLength;
86+ simtime_t elapsedTickTime = fmod (currentSimTime - baseTickTime, oldCurrentTickLength);
8787 SimTimeScale newDriftFactor = SimTimeScale::fromPpm (newDriftRate.get <ppm>());
8888 driftRate = newDriftRate;
8989 setDriftFactor (newDriftFactor);
You can’t perform that action at this time.
0 commit comments