Thread: I need function that can get time for less than a second

  1. #1
    Registered User
    Join Date
    Oct 2002

    Question I need function that can get time for less than a second

    I have to make a runtime analysis of quicksort and selection sort. For this, i need to determine the average runtime of sorting 100 integers. I tried using clock() and time() but i think these return time in seconds. The program however takes less than a second so the value returned is 0. what else can I use?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    If you're allowed to include windows.h, you can use GetTickCount(), which returns the number of milliseconds since windows started.
    Run it two times and calculate the differemce.

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. Sending an email in C program
    By Moony in forum C Programming
    Replies: 28
    Last Post: 10-19-2006, 10:42 AM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Replies: 5
    Last Post: 02-08-2003, 07:42 PM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM