diff options
author | UbitUmarov | 2017-05-12 03:53:18 +0100 |
---|---|---|
committer | UbitUmarov | 2017-05-12 03:53:18 +0100 |
commit | a932f24ba4583f5a0b7a149ffc39ac4814df3c31 (patch) | |
tree | 3513052021fac032a9d4ccc499bfe999e276dbd4 | |
parent | avoid a null ref (diff) | |
download | opensim-SC-a932f24ba4583f5a0b7a149ffc39ac4814df3c31.zip opensim-SC-a932f24ba4583f5a0b7a149ffc39ac4814df3c31.tar.gz opensim-SC-a932f24ba4583f5a0b7a149ffc39ac4814df3c31.tar.bz2 opensim-SC-a932f24ba4583f5a0b7a149ffc39ac4814df3c31.tar.xz |
minor fix on sensorrepeat
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 1808c34..cc98bbb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -160,7 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
160 | ts.arc = arc; | 160 | ts.arc = arc; |
161 | ts.host = host; | 161 | ts.host = host; |
162 | 162 | ||
163 | ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); | 163 | ts.next = DateTime.UtcNow.AddSeconds(ts.interval); |
164 | 164 | ||
165 | AddSenseRepeater(ts); | 165 | AddSenseRepeater(ts); |
166 | } | 166 | } |
@@ -196,14 +196,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
196 | public void CheckSenseRepeaterEvents() | 196 | public void CheckSenseRepeaterEvents() |
197 | { | 197 | { |
198 | // Go through all timers | 198 | // Go through all timers |
199 | foreach (SensorInfo ts in SenseRepeaters) | 199 | |
200 | List<SensorInfo> curSensors; | ||
201 | lock(SenseRepeatListLock) | ||
202 | curSensors = SenseRepeaters; | ||
203 | |||
204 | DateTime now = DateTime.UtcNow; | ||
205 | foreach (SensorInfo ts in curSensors) | ||
200 | { | 206 | { |
201 | // Time has passed? | 207 | // Time has passed? |
202 | if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) | 208 | if (ts.next < now) |
203 | { | 209 | { |
204 | SensorSweep(ts); | 210 | SensorSweep(ts); |
205 | // set next interval | 211 | // set next interval |
206 | ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); | 212 | ts.next = now.AddSeconds(ts.interval); |
207 | } | 213 | } |
208 | } | 214 | } |
209 | } | 215 | } |