Thread: Code Priorities?

  1. #16
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    This is the sleep-function I use
    Code:
    #include <ctime>
    sleep(double secs)
    { 
        using namespace std;
        clock_t end_time = clock() + clock_t(secs*CLOCKS_PER_SEC);
        while (clock() < end_time);
    }
    But it isn't super. The processor-usage will be 100% during the sleep. It is the best one can do in ANSI/ISO C++, though.
    Last edited by Sang-drax; 10-17-2002 at 04:10 AM.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Proposal: Code colouring
    By Perspective in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 07:23 AM
  2. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  3. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM