minor fix on sensorrepeat

0.9.0-post-fixes
UbitUmarov 2017-05-12 03:53:18 +01:00
parent 19d141c9a5
commit a932f24ba4
1 changed files with 10 additions and 4 deletions

View File

@ -160,7 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
ts.arc = arc; ts.arc = arc;
ts.host = host; ts.host = host;
ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); ts.next = DateTime.UtcNow.AddSeconds(ts.interval);
AddSenseRepeater(ts); AddSenseRepeater(ts);
} }
@ -196,14 +196,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
public void CheckSenseRepeaterEvents() public void CheckSenseRepeaterEvents()
{ {
// Go through all timers // Go through all timers
foreach (SensorInfo ts in SenseRepeaters)
List<SensorInfo> curSensors;
lock(SenseRepeatListLock)
curSensors = SenseRepeaters;
DateTime now = DateTime.UtcNow;
foreach (SensorInfo ts in curSensors)
{ {
// Time has passed? // Time has passed?
if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) if (ts.next < now)
{ {
SensorSweep(ts); SensorSweep(ts);
// set next interval // set next interval
ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); ts.next = now.AddSeconds(ts.interval);
} }
} }
} }