Q:

maketime() in c changes my time input

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?

A:

Check tm_isdst. @FUZxxl
mktime() does not restrict the fields like tm_year, tm_isdst, tm_hour to their primary range.  Not only does it return time_t, it updates the fields to their primary range.
In setting up ThreadTime, code did not set the tm_isdst field.  The call to mktime() adjusted it and tm_hour.

struct tm could have many fields, best to initialize all of them.
tm_isdt has 3 settings:
-int standard/daylight savings time setting unknown, let system decide
zero standard time
+int daylight savings time  
void find_difference(absolute_time *t) {
  memset(&ThreadTime, 0, sizeof ThreadTime);
  ThreadTime.tm_isdst = -1;
  ThreadTime.tm_year  = t->yy - 1900; // thread time
  ThreadTime.tm_mon   = t->mm - 1;
  ...

The unposted code that printed ms_t as "time delay: 2832`" has questionable output.  Expected something like:
double diff = difftime(mktime(TimeInfo),mktime(&ThreadTime)); 
printf(" time delay: %0.3f\n", diff);

