diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 77985bd72f..d1cdaa67c4 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -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; + } + /// /// Formats a duration (given in milliseconds). ///