File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -969,7 +969,12 @@ public class PseudoRealtimeSimulation : ThreadSafeSimulation {
969
969
/// The current model time. Note that, while in realtime, this may continuously change.
970
970
/// </summary>
971
971
public override DateTime Now {
972
- get { lock ( _timeLocker ) { return base . Now + _rtDelayTime . Elapsed ; } }
972
+ get {
973
+ lock ( _timeLocker ) {
974
+ if ( ! IsRunningInRealtime ) return base . Now ;
975
+ return base . Now + TimeSpan . FromMilliseconds ( _rtDelayTime . Elapsed . TotalMilliseconds * RealtimeScale . Value ) ;
976
+ }
977
+ }
973
978
protected set => base . Now = value ;
974
979
}
975
980
@@ -1009,7 +1014,7 @@ public override void Step() {
1009
1014
var observed = _rtDelayTime . Elapsed ;
1010
1015
1011
1016
lock ( _locker ) {
1012
- if ( rtScale . Value != 1.0 ) observed = TimeSpan . FromMilliseconds ( observed . TotalMilliseconds / rtScale . Value ) ;
1017
+ if ( rtScale . Value != 1.0 ) observed = TimeSpan . FromMilliseconds ( observed . TotalMilliseconds * rtScale . Value ) ;
1013
1018
if ( _rtDelayCtrl . IsCancellationRequested && observed < delay ) {
1014
1019
lock ( _timeLocker ) {
1015
1020
Now = base . Now + observed ;
You can’t perform that action at this time.
0 commit comments