Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Iterate on second

Name: Anonymous 2007-08-25 6:47 ID:sc0LfXCq

I've been trying to make a loop that will only repeat when a second has passed.  Basically it will check every second to see if the current time is equal to a specified time.  At the moment my program just repeats the same number about a thousand times before  it reaches the next one...any halp guyz?

Name: Anonymous 2007-08-25 6:52 ID:Heaven

#include <time.h>
main() {
    for (;;) {
        int n = time(NULL);
        while (n == time(NULL));
        /* do stuff */
    }
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List