Realy a dont know how I was missing this !
Anyway, thanks alot for the help ! My code now is:
Code:
#include <time.h>
main()
{
char s[50],s2[50];
size_t i;
size_t i2;
struct tm tim;
struct tm tim2;
time_t now;
time_t now2;
now = time(NULL);
now2 = now - (5 * 60);
tim = *(localtime(&now));
tim2 = *(localtime(&now2));
i = strftime(s,50,"%b %d, %Y; %H:%M:%S",&tim);
i2 = strftime(s2,50,"%b %d, %Y; %H:%M:%S",&tim2);
printf("time: [%s]\n",s);
printf("now: [%d]\n\n",now);
printf("time2: [%s]\n",s2);
printf("now2: [%d]\n",now2);
}
and works well !
About running every 5 minutes, this is a daemon that sleeps for 5 seconds and reads the file again !
Once more, thanks !