fix(core): Fixes date time uses by using stop watch (#549)

- [X] Replaces measurements with stop watch
- [X] Some cleanup
This commit is contained in:
Kamron Batman 2021-03-13 12:39:30 -08:00 committed by GitHub
parent 6c4308bce6
commit 76970325a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 13 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using Server.Items;
using Server.PathAlgorithms;
using Server.PathAlgorithms.FastAStar;
@ -71,18 +72,18 @@ namespace Server
{
OverrideAlgorithm = alg;
var start = DateTime.UtcNow.Ticks;
var watch = new Stopwatch();
watch.Start();
var path = new MovementPath(from, new Point3D(p));
var end = DateTime.UtcNow.Ticks;
var len = Math.Round((end - start) / 10000.0, 2);
watch.Stop();
if (!path.Success)
{
from.SendMessage("{0} path failed: {1}ms", name, len);
from.SendMessage("{0} path failed: {1}ms", name, watch.ElapsedMilliseconds);
}
else
{
from.SendMessage("{0} path success: {1}ms", name, len);
from.SendMessage("{0} path success: {1}ms", name, watch.ElapsedMilliseconds);
var x = from.X;
var y = from.Y;