Can I please get some help finding difftime(finish, start)?

This is a discussion on Can I please get some help finding difftime(finish, start)? within the C Programming forums, part of the General Programming Boards category; I am trying to find the elapsed time for my function to operate. I have looked quite a few places ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    3

    Can I please get some help finding difftime(finish, start)?

    I am trying to find the elapsed time for my function to operate. I have looked quite a few places on google; however, I have not been able to find a solution that works with my X-Win32 compiler. The code that i am trying now is as follows:

    #include <time.h>
    #include <stdio.h>
    #include <stdlib.h>

    main(){

    time_t start, finish;

    time(&start);

    ....

    time(&finish);

    printf("The elapsed time is: %6.0f", difftime( finish, start));
    }


    Any suggestions would be greatly appreciated, Thanks!

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    time() is not accurate enough to clock most function calls! look into

    best i can give ya.

    QueryPerformanceCounter()
    QueryPerformanceFrequency()

    i dont know if these are cross platform ( i know they exist on windows) but i do know they don't work on all processors

    on windows search for info on them here

    http://www.msdn.microsoft.com
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Registered User stautze's Avatar
    Join Date
    Apr 2002
    Posts
    195

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Finding Program Running Time
    By pf732k3 in forum C Programming
    Replies: 6
    Last Post: 03-18-2008, 01:56 PM
  2. C++ gui for windows where to start
    By prixone in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2006, 10:48 PM
  3. GNOME Desktop won't start (Mandriva)
    By psychopath in forum Tech Board
    Replies: 10
    Last Post: 07-19-2006, 01:21 PM
  4. WHEN to start game programming
    By mrcheesypants in forum Game Programming
    Replies: 18
    Last Post: 02-02-2006, 03:09 PM
  5. start another program
    By lshome in forum C Programming
    Replies: 3
    Last Post: 06-24-2002, 01:48 PM

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