time functions

This is a discussion on time functions within the C Programming forums, part of the General Programming Boards category; why does this short piece of code result in a spectacular loop, followed by my crashed computer? I am using ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    8

    time functions

    why does this short piece of code result in a spectacular loop, followed by my crashed computer? I am using miracle c compiler:

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


    main()
    {
    printf("1234");

    printf("\nProgram execution time using clock() = %ld hundredths of a second.", clock());

    return(0);
    }

    many thanks to the person who canhelp!!

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    A spectacular loop? I compiled, using GCC, and had no problems with it.

    Perhaps there is some problem with the clock() function, according to the standard the return value of the function is of type clock_t, but this is implementation defined. Which means, how this type is implemented, depends on how the manufacturer of the compiler implemented it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help in time zone
    By Gong in forum C++ Programming
    Replies: 2
    Last Post: 01-03-2007, 03:44 AM
  2. Help with assignment!
    By RVDFan85 in forum C++ Programming
    Replies: 12
    Last Post: 12-02-2006, 11:46 PM
  3. The space time continueimnms mm... (rant)
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 32
    Last Post: 06-27-2004, 01:21 PM
  4. I apologize. Good bye.
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 05-03-2002, 06:51 PM
  5. help with functions (first time)
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 03-06-2002, 08:37 PM

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