mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
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)
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user