Results 1 to 1 of 1

Thread: High precission timer for C# and Windows.

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    High precission timer for C# and Windows.

    Notice that this class will not work in Linux, since it is using Windows API. It will neither work on old hardware, since it is using the instructions on the CPU to do the actual messurment. And it has to be implemented in the hardware. To not scare you totaly away, I have never seen a computer that doesn't have it implemented.


    Example of use:
    Code:
            GameTimer gt = new GameTimer();
    
            for (int i = 0; i < 10; i ++){
            	int test = 3*9;
            }
            
            Console.WriteLine("1). Time Elapsed: " + gt.GetElapsedTime().ToString());
            
            // Resets the timer, so you can start to time a new "event".
            gt.Mark();
            
            for (int i = 0; i < 10; i ++){
            	int test = 3*9;
            }
            
            Console.WriteLine("2). Time Elapsed: " + gt.GetElapsedTime().ToString());

    - ØØ -
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width