From 4e64445c39c3de1941e071ff32d06702a3440d5d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Nov 2016 05:18:06 +0000 Subject: [PATCH] replace datetime.now on just timming by faster utcnow --- OpenSim/Region/Framework/Scenes/Scene.cs | 3 ++- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 6 +++--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++--- .../Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c349369604..09f0b19201 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5454,6 +5454,7 @@ Label_GroupsDone: public void CleanTempObjects() { + DateTime now = DateTime.UtcNow; EntityBase[] entities = GetEntities(); foreach (EntityBase obj in entities) { @@ -5465,7 +5466,7 @@ Label_GroupsDone: { if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) { - if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= DateTime.Now) + if (grp.GetSittingAvatarsCount() == 0 && grp.RootPart.Expires <= now) DeleteSceneObject(grp, false); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index e643db7436..0cd738daa3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -153,9 +153,9 @@ namespace OpenSim.Region.Framework.Scenes { m_scene.SceneGraph.FireChangeBackup(this); } - timeLastChanged = DateTime.Now.Ticks; + timeLastChanged = DateTime.UtcNow.Ticks; if (!m_hasGroupChanged) - timeFirstChanged = DateTime.Now.Ticks; + timeFirstChanged = DateTime.UtcNow.Ticks; if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null) { /* @@ -233,7 +233,7 @@ namespace OpenSim.Region.Framework.Scenes m_minPersistTime = m_scene.m_dontPersistBefore; } - long currentTime = DateTime.Now.Ticks; + long currentTime = DateTime.UtcNow.Ticks; if (timeLastChanged == 0) timeLastChanged = currentTime; if (timeFirstChanged == 0) timeFirstChanged = currentTime; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9d1dca2725..3a06e7df42 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -185,8 +185,7 @@ namespace OpenSim.Region.Framework.Scenes return !(SitTargetPosition == Vector3.Zero && (SitTargetOrientation == Quaternion.Identity // Valid Zero Rotation quaternion - || SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 1f && SitTargetOrientation.W == 0f // W-Z Mapping was invalid at one point - || SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 0f && SitTargetOrientation.W == 0f)); // Invalid Quaternion + || (SitTargetOrientation.W == 0f && SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 0f ))); // Invalid Quaternion } } @@ -1909,7 +1908,7 @@ namespace OpenSim.Region.Framework.Scenes public void ResetExpire() { - Expires = DateTime.Now + new TimeSpan(600000000); + Expires = DateTime.UtcNow + new TimeSpan(600000000); } public void AddFlag(PrimFlags flag) diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index d72590792a..7129c8a241 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -880,7 +880,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance try { m_CurrentEvent = data.EventName; - m_EventStart = DateTime.Now; + m_EventStart = DateTime.UtcNow; m_InEvent = true; try @@ -1033,7 +1033,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance if (!m_InEvent) return 0; - return (DateTime.Now - m_EventStart).Seconds; + return (DateTime.UtcNow - m_EventStart).Seconds; } public void ResetScript(int timeout)