I'm trying to create a timing mechanism so that a console application that I'm working on runs at roughly 10 frames a second. When I run this code, rather than being a smooth 20 frames a second it is stuttery and freezes often. I'm having trouble debugging this due to the fact that it relies on the DateTime.Now.Millisecond function, so whenever I insert a break into the code it messes up the timings of the application.
do
{
    frameTimer = DateTime.Now.Millisecond;
    if (firstLoop == true)
    {
        timeTillNextFrame = frameTimer + 100;
        firstLoop = false;
    }
    if (timeTillNextFrame < DateTime.Now.Millisecond && DateTime.Now.Millisecond < 901)
    {
        Console.Clear();
        grid.removeFromGrid(ball.xPos, ball.yPos);
        ball.newPos(gridSizeX, gridSizeY, grid.gridArray);
        grid.addToGrid(ball.xPos, ball.yPos, ball.symbol);
        grid.gridDraw(gridSizeX, gridSizeY);
        timeTillNextFrame = DateTime.Now.Millisecond + 50;
        if (timeTillNextFrame >= 1000)
        {
            timeTillNextFrame -= 1000;
        }
    }
 
     
    