calculate elapsed-time

This is a discussion on calculate elapsed-time within the C Programming forums, part of the General Programming Boards category; Hi, If I want to calculate the elapsed-time of some operations, like sorting a array, which header should i use ...

  1. #1
    Unregistered
    Guest

    calculate elapsed-time

    Hi,

    If I want to calculate the elapsed-time of some operations, like sorting a array, which header should i use and which function should i use?

    probably the first answer will help me to find the second answer myself. Please advise.

    joey

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    What operating system and compiler?
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Unregistered
    Guest
    i use Visual C++ on Windows

  4. #4
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    look into QueryPerformanceCounter()
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  5. #5
    Unregistered
    Guest
    In C++, to calculate the elapsed time, we can use

    CTime startTime = CTime::GetCurrentTime();
    // ... perform time-consuming task ...
    CTime endTime = CTime::GetCurrentTime();
    CTimeSpan elapsedTime = endTime - startTime;

    What is the method in C?

  6. #6
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    read this and this too
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using pointers
    By Big_0_72 in forum C Programming
    Replies: 3
    Last Post: 10-28-2008, 07:51 PM
  2. Determine the closest departure time
    By Kyeong in forum C Programming
    Replies: 9
    Last Post: 10-07-2008, 08:06 PM
  3. Killing someones grandparents
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 37
    Last Post: 09-07-2003, 07:56 AM
  4. The Timing is incorret
    By Drew in forum C++ Programming
    Replies: 5
    Last Post: 08-28-2003, 04:57 PM
  5. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 09:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21