I really dont know why this is happening, but here is the abstract of it. The code belows shows my attempt to find the time difference (to check if the given time is in the past or present) using mktime and finally difftime, but what I am finding is that the "hour" part of the output is modified - reduced by one hour Can anyone tell me if I am doing something wrong here?
void find_difference(absolute_time *t)
{
ThreadTime.tm_year = t->yy - 1900; // thread time
ThreadTime.tm_mon = t->mm - 1;
ThreadTime.tm_mday = t->dd;
ThreadTime.tm_hour = t->hr;
ThreadTime.tm_min = t->min;
ThreadTime.tm_sec = t->sec;`
printf("\n thread : date:%d/%d/%d Time: %d:%d: %d\n", ThreadTime.tm_year,ThreadTime.tm_mon,ThreadTime.tm_mday,ThreadTime.tm_hour,ThreadTime.tm_min,ThreadTime.tm_sec);
ms_t = difftime(mktime(TimeInfo),mktime(&ThreadTime)); // current - thread
printf(" thread : date:%d/%d/%d Time: %d:%d:%d\n", ThreadTime.tm_year,ThreadTime.tm_mon,ThreadTime.tm_mday,ThreadTime.tm_hour,ThreadTime.tm_min,ThreadTime.tm_sec);
}
The output is as follows:
thread : date:114/11/11 Time: 16:25:0
thread : date:114/11/11 Time: 15:25:0
time delay: 2832`
Is there anything that I am doing wrong?