mktime changing tm_hour during execute ??

During execution of mktime(), only value of tm_hour changes.

Copy of part of code:

1 strcpy(s_1, PRDATA.periode[per_tel].start_w); // s_1 = hhmm

2 // start werktijd in seconden
3 str_ptr = strrchr(s_1, 0); // find end of str
4 m = atoi(str_ptr -= 2); // extract minutes
5 tydblok.tm_min = m; // fill minutes
6 *str_ptr = 0; // kill str after hours
7 h = atoi(str_ptr -= 2); // extract hours
8 tydblok.tm_hour = h; // fill hours
9 b_w_time = mktime(&tydblok);// calculate time in secs

Mostly all goes well. Sometimes e.g. "0233" as string happens as follows:

line 7: h becomes 2, tm_hour = 3 (previous value).
line 8: h stays 2, tm_hour becomes 2 (all seems well).
line 9: b_w_time becomes too small value and tm_hour changed to 1 ???

Can anyone explane to me what is going wrong ?
Topic archived. No new replies allowed.