Hey Elysia. I used your advise about gmtime and have come up with this. I dont have a compiler here in work so i'm not sure if works.
Code:
void storeTime(FILE *p1)
{
time_t tim;
struct tm *curtim;
time(&tim);
curtim =gmtime(&tim);
p1 = fopen("timestore.txt",w);
if(p1 != NULL)
{
fprintf(p1,"%d %d %d",curtim->tm_mday,curtim->tm_mon,curtim->tm_year);
fclose(p1);
}
}
void readtime () //reads the time which was stored in the file by storetime
{
FILE *p2 //file pointer
tm *newtm; // new tm structure
time_t timer; //used with mktime()
double diff; //used to store the difference in times
p2 = fopen("timestore.txt",r);
if(p2 != NULL)
{
fscanf(p2,%d %d %d,newtm->tm_dat,newtm->tm_mon,newtm->tm_year); //scam the times from file
fclose(p2);
}
timer = mktime(newtm); // give timer a value
//create a time_t for current time to compare
time_t timeNow;
time(&timeNow);
diff = difftime(timeNow,timer);
printf("%d : Time difference in seconds",diff);
}