Thread: Real Time?

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Waterloo, Texas

    Real Time?

    So I have a clock problem to. I want to update the clock in real time so that I can see the seconds tick by!
    Here's what I am using:

    char *aORp;
    int tm_year;
    struct tm *systime;
    time_t t;
    if(systime->tm_hour>12) {systime->tm_hour=
    systime->tm_hour-12; aORp = "p.m."; }
    else{aORp = "a.m.";}

    I would hate to call "t=time(NULL);" every other line of code!(And I'm sure it's not done this way).

    But I just don't know how to write a function that runs constantly yet releases the rest of the program to resume normally!
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
        return std::pow
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;

  2. #2
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    use a master loop which contains this updating code and any other code you'd want to have run simultaneously... then use static or global data [*gulp*] to save the states for continuation in the next cycle...
    hasafraggin shizigishin oppashigger...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Weird Times I'm getting
    By afflictedd2 in forum Linux Programming
    Replies: 8
    Last Post: 07-23-2008, 07:18 AM
  2. Real time access to display image
    By abachler in forum Windows Programming
    Replies: 3
    Last Post: 07-21-2008, 05:30 PM
  3. time synchronization problem
    By freeindy in forum C Programming
    Replies: 1
    Last Post: 04-19-2007, 06:25 AM
  4. Programming Puns
    By kermi3 in forum A Brief History of
    Replies: 44
    Last Post: 03-23-2002, 04:38 PM
  5. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 10:12 PM