Thread: clock

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    5

    clock

    i was wondering if in C you could create clock that counts up and store the time at certain points. if you can, could you point me in the right direction with a tutorial?



    Thank you

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    C provides time-related services via the <time.h> header.
    here's an example from the FAQ, too.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    This was a recent thread where I posted a clock program. It even prints the clock prettily too! Saving the time at regular intervals is an exercise for you, but it shouldn't be difficult at all with the source base I posted in that thread to start from.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logical Error in Clock program
    By SVXX in forum C++ Programming
    Replies: 0
    Last Post: 05-10-2009, 12:12 AM
  2. Outside influences on clock cycles? (clock_t)
    By rsgysel in forum C Programming
    Replies: 4
    Last Post: 01-08-2009, 06:15 PM
  3. Clock Troubles
    By _Nate_ in forum C Programming
    Replies: 22
    Last Post: 06-19-2008, 05:15 AM
  4. clock program
    By bazzano in forum C Programming
    Replies: 3
    Last Post: 03-30-2007, 10:12 PM
  5. System clock
    By bazzano in forum C Programming
    Replies: 10
    Last Post: 03-27-2007, 10:37 AM