replace datetime.now on just timming by faster utcnow

melanie
UbitUmarov 2016-11-22 05:18:06 +00:00
parent 7524c7729f
commit 4e64445c39
4 changed files with 9 additions and 9 deletions

View File

@ -5454,6 +5454,7 @@ Label_GroupsDone:
public void CleanTempObjects() public void CleanTempObjects()
{ {
DateTime now = DateTime.UtcNow;
EntityBase[] entities = GetEntities(); EntityBase[] entities = GetEntities();
foreach (EntityBase obj in entities) foreach (EntityBase obj in entities)
{ {
@ -5465,7 +5466,7 @@ Label_GroupsDone:
{ {
if ((grp.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0) 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); DeleteSceneObject(grp, false);
} }
} }

View File

@ -153,9 +153,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_scene.SceneGraph.FireChangeBackup(this); m_scene.SceneGraph.FireChangeBackup(this);
} }
timeLastChanged = DateTime.Now.Ticks; timeLastChanged = DateTime.UtcNow.Ticks;
if (!m_hasGroupChanged) if (!m_hasGroupChanged)
timeFirstChanged = DateTime.Now.Ticks; timeFirstChanged = DateTime.UtcNow.Ticks;
if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null) 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; m_minPersistTime = m_scene.m_dontPersistBefore;
} }
long currentTime = DateTime.Now.Ticks; long currentTime = DateTime.UtcNow.Ticks;
if (timeLastChanged == 0) timeLastChanged = currentTime; if (timeLastChanged == 0) timeLastChanged = currentTime;
if (timeFirstChanged == 0) timeFirstChanged = currentTime; if (timeFirstChanged == 0) timeFirstChanged = currentTime;

View File

@ -185,8 +185,7 @@ namespace OpenSim.Region.Framework.Scenes
return return
!(SitTargetPosition == Vector3.Zero !(SitTargetPosition == Vector3.Zero
&& (SitTargetOrientation == Quaternion.Identity // Valid Zero Rotation quaternion && (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.W == 0f && SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 0f ))); // Invalid Quaternion
|| SitTargetOrientation.X == 0f && SitTargetOrientation.Y == 0f && SitTargetOrientation.Z == 0f && SitTargetOrientation.W == 0f)); // Invalid Quaternion
} }
} }
@ -1909,7 +1908,7 @@ namespace OpenSim.Region.Framework.Scenes
public void ResetExpire() public void ResetExpire()
{ {
Expires = DateTime.Now + new TimeSpan(600000000); Expires = DateTime.UtcNow + new TimeSpan(600000000);
} }
public void AddFlag(PrimFlags flag) public void AddFlag(PrimFlags flag)

View File

@ -880,7 +880,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
try try
{ {
m_CurrentEvent = data.EventName; m_CurrentEvent = data.EventName;
m_EventStart = DateTime.Now; m_EventStart = DateTime.UtcNow;
m_InEvent = true; m_InEvent = true;
try try
@ -1033,7 +1033,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (!m_InEvent) if (!m_InEvent)
return 0; return 0;
return (DateTime.Now - m_EventStart).Seconds; return (DateTime.UtcNow - m_EventStart).Seconds;
} }
public void ResetScript(int timeout) public void ResetScript(int timeout)