Hello DaniWeb,
So I have a function:
time_t current_time = time( NULL );
while ( 1 )
if ( time( NULL ) == current_time + 3600 ) // execute body every hour
{
// stuff
current_time = time( NULL );
}
This is the only way I could think of doing it, but it just doesn't seem right to have to use while(1)
. When I look at the processor's activity, it is hogging a lot of CPU power and making tons of system calls probably for time()
, since it has to check the condition over and over and over.
Is there a less expensive way to do this? Thank you in advance