"Victor Bazarov" <(EMail Removed)> wrote...
> "Jonas Granqvist" <(EMail Removed)> wrote...
> > I wonder if someone could help me with some sample code on how to make a
> > simple application using time. How can I for instance make the program
> > run the function "foobar()" every ten seconds? I've seen programs using
> > the time.h include file, is that the one to use?
>
> Pseudocode:
>
> 1. Read system time (using time() function)
> 2. Calculate the value of what 'time' should return ten
> seconds from now (using localtime() and mktime()
> functions), assign it to 'future' variable
> 3. Call foobar()
> 4. Read system time.
> 5. If system time is the same as or greater than 'future',
> go to 3. Otherwise go to 4.
Error. Should be
5. If system time is the same as or greater than 'future',
go to 1. Otherwise go to 4.
Victor
