mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
- remove SlimDX Stopwatch
This commit is contained in:
parent
3cff90d716
commit
c8845ae559
3 changed files with 15 additions and 23 deletions
|
@ -136,21 +136,21 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
public static void StartTimer()
|
||||
{
|
||||
starttime = SlimDX.Configuration.Timer.ElapsedMilliseconds;
|
||||
starttime = Clock.Timer.ElapsedMilliseconds;
|
||||
}
|
||||
|
||||
public static void PauseTimer()
|
||||
{
|
||||
if(starttime == -1) throw new InvalidOperationException("DebugConsole.StartTimer() must be called before DebugConsole.PauseTimer()!");
|
||||
|
||||
storedtime += SlimDX.Configuration.Timer.ElapsedMilliseconds - starttime;
|
||||
storedtime += Clock.Timer.ElapsedMilliseconds - starttime;
|
||||
}
|
||||
|
||||
public static void StopTimer(string message)
|
||||
{
|
||||
if(starttime == -1) throw new InvalidOperationException("DebugConsole.StartTimer() must be called before DebugConsole.StopTimer()!");
|
||||
|
||||
long duration = SlimDX.Configuration.Timer.ElapsedMilliseconds - starttime + storedtime;
|
||||
long duration = Clock.Timer.ElapsedMilliseconds - starttime + storedtime;
|
||||
|
||||
if(message.Contains("%"))
|
||||
message = message.Replace("%", duration.ToString(CultureInfo.InvariantCulture));
|
||||
|
|
|
@ -14,20 +14,27 @@
|
|||
|
||||
#endregion
|
||||
|
||||
using SlimDX;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace CodeImp.DoomBuilder
|
||||
{
|
||||
public static class Clock
|
||||
{
|
||||
// This queries the system for the current time
|
||||
public static long CurrentTime { get { return Configuration.Timer.ElapsedMilliseconds; } }
|
||||
static Clock()
|
||||
{
|
||||
Timer = new Stopwatch();
|
||||
}
|
||||
|
||||
public static Stopwatch Timer { get; private set; }
|
||||
|
||||
// This queries the system for the current time
|
||||
public static long CurrentTime { get { return Clock.Timer.ElapsedMilliseconds; } }
|
||||
|
||||
//mxd. Timer needs to be reset from time to time (like, every 2 days of continuously running the editor) to prevent float precision degradation.
|
||||
internal static void Reset()
|
||||
{
|
||||
Configuration.Timer.Reset();
|
||||
Configuration.Timer.Start();
|
||||
Clock.Timer.Reset();
|
||||
Clock.Timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -306,19 +306,4 @@ namespace SlimDX
|
|||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Stop watch timer
|
||||
// Actually System.Diagnostics (System.Runtime.Extensions.dll, System.dll, netstandard.dll)
|
||||
public class StopWatch
|
||||
{
|
||||
public long ElapsedMilliseconds { get; }
|
||||
public void Reset() { }
|
||||
public void Start() { }
|
||||
}
|
||||
|
||||
public class Configuration
|
||||
{
|
||||
public static StopWatch Timer { get; set; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue