Thread: Faster than 1 second

  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-12-2005, 11:18 PM
  3. Which Is Faster?
    By GaPe in forum C Programming
    Replies: 4
    Last Post: 10-25-2003, 10: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, 07:18 AM