Faster than 1 second

This is a discussion on Faster than 1 second within the C Programming forums, part of the General Programming Boards category; My program works perfectly but time_t t0 = time(NULL); //some stuff time_t t1 = time(NULL);//stores the current time in seconds ...

  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    45

    Faster than 1 second

    My program works perfectly but

    time_t t0 = time(NULL);
    //some stuff
    time_t t1 = time(NULL);//stores the current time in seconds in t1
    iElapsedYah = t1-t0;
    printf("It took %d seconds", iElapsedYah);

    but sometimes the code runs so fast that iElapsedYah = 0
    but its actually 0.5 seconds
    so how can i make a code that can take into account time in something that is not in seconds but faster

    like a float that can take into account the milli or nano seconds

    i am using windows 7 and my complier is Dev C++

  2. #2
    Registered User
    Join Date
    Feb 2013
    Posts
    45
    never mind i figured it out !!!!!!!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why is this faster
    By Alienchicken in forum C Programming
    Replies: 4
    Last Post: 03-08-2011, 12:41 AM
  2. which is faster?
    By anykey in forum C++ Programming
    Replies: 7
    Last Post: 08-13-2005, 12:18 AM
  3. Which Is Faster?
    By GaPe in forum C Programming
    Replies: 4
    Last Post: 10-25-2003, 11:20 AM
  4. Anyone got a faster way of doing this?
    By dpro in forum C++ Programming
    Replies: 9
    Last Post: 03-07-2003, 06:44 PM
  5. Which is Faster....
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-19-2002, 08:18 AM

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