JAVA's System.currentTimeMillis() or C#'s Environment.TickCount?
<p>Hey, as of lately, I've been trying to find good ways to smoothen out thread sleeps (incase it gets disturbed or if your computer laggs etc).</p>

<p>So which is an overall "better performance" method?</p>

<p>JAVA's System.currentTimeMillis() method for C#:</p>

<pre><code>public static double GetCurrentMilliseconds()
{
    DateTime staticDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
    TimeSpan timeSpan = DateTime.UtcNow - staticDate;
    return timeSpan.TotalMilliseconds;
}
</code></pre>

<p>System.currentTimeMillis() in use:</p>

<pre><code>    public void Run()
    {
        this.lastUpdate = TimeUtilities.GetCurrentMilliseconds();
        while (isRunning)
        {
            if (TimeUtilities.GetCurrentMilliseconds() - lastUpdate &gt;= 600)
            {
                lastUpdate = TimeUtilities.GetCurrentMilliseconds();
                // bla bla bla...
            }

            try
            {
                Thread.Sleep(100);
            }
            catch (Exception ex)
            {
                Jolt.GetLog().WriteException(ex);
            }
        }
    }
</code></pre>

<p>and C#'s Environment.TickCount:</p>

<pre><code>    private void Run()
    {
        double lastUpdate = Environment.TickCount;

        while (isRunning)
        {
            if (lastUpdate + 600 &lt; Environment.TickCount)
            {
                lastUpdate = Environment.TickCount;
                // bla bla bla...
            }

            try
            {
                Thread.Sleep(100);
            }
            catch (Exception ex)
            {
                Jolt.GetLog().WriteException(ex);
            }
        }
    }
</code></pre>

<p>Any help would be appreciated. Otherwise if this is a bad idea, could you please provide a better way to do this.</p>
