add a GetTimeStampMS method, this returns a time stamp in miliSeconds with the resolution avaiable for StopWatchs. Value in double since it can be large (as machine uptime in high resolution ticks)
parent
ac4b2b2f50
commit
f0c865555b
|
@ -140,10 +140,14 @@ namespace OpenSim.Framework
|
|||
|
||||
public static readonly int MAX_THREADPOOL_LEVEL = 3;
|
||||
|
||||
public static double TimeStampClockPeriodMS;
|
||||
|
||||
static Util()
|
||||
{
|
||||
LogThreadPool = 0;
|
||||
LogOverloads = true;
|
||||
TimeStampClockPeriodMS = 1000.0D / (double)Stopwatch.Frequency;
|
||||
m_log.InfoFormat("[UTIL] TimeStamp clock with period of {0}ms", Math.Round(TimeStampClockPeriodMS,6,MidpointRounding.AwayFromZero));
|
||||
}
|
||||
|
||||
private static uint nextXferID = 5000;
|
||||
|
@ -2662,6 +2666,13 @@ namespace OpenSim.Framework
|
|||
return tcA - tcB;
|
||||
}
|
||||
|
||||
// returns a timestamp in ms as double
|
||||
// using the time resolution avaiable to StopWatch
|
||||
public static double GetTimeStampMS()
|
||||
{
|
||||
return (double)Stopwatch.GetTimestamp() * TimeStampClockPeriodMS;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formats a duration (given in milliseconds).
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue