Hello Reen -
Do you want a function you can poll and have it return TRUE if 5 seconds have gone by?
Note that C does not have a native BOOL type, but integers can be used in logical expressions, with 0 being false and non-zero being true.
I think this code should work --- let me know if it doesn't. Bob
#include
#define TRUE 1
#define FALSE 0
static unsigned short CheckFiveSecondsElapsed(void) {
static time_t oldtime;
time_t newtime = time(&newtime);
if (difftime(newtime, oldtime) >= 5) {
oldtime = newtime;
return TRUE;
}
else {
return FALSE;
}
} // end, CheckFiveSecondsElapsed