Looks like localtime returns 3 hours instead of 4.And datetimes for current time_t:
[...]Difference between gmtime and localtime is 4 hours. Bug? Feature?
"The localtime() function shall convert the time in seconds since the Epoch pointed to by timer into a broken-down time, expressed as a local time. The function corrects for the timezone and any seasonal time adjustments. [CX] Local timezone information is used as though localtime() calls tzset()."