Fix year handling in mbus_data_tm_decode

According to ANSI C the member tm_year saves the years since
1900.
This commit is contained in:
Stefan Wahren
2016-07-23 07:56:38 +00:00
parent 6fd4ca2714
commit 094c9ef453
2 changed files with 8 additions and 8 deletions

View File

@ -878,7 +878,7 @@ int mbus_variable_value_decode(mbus_data_record *record, double *value_out_real,
return -1;
}
*value_out_str_size = snprintf(*value_out_str, 11, "%04d-%02d-%02d",
(time.tm_year + 2000),
(time.tm_year + 1900),
(time.tm_mon + 1),
time.tm_mday);
result = 0;
@ -910,7 +910,7 @@ int mbus_variable_value_decode(mbus_data_record *record, double *value_out_real,
return -1;
}
*value_out_str_size = snprintf(*value_out_str, 20, "%04d-%02d-%02dT%02d:%02d:%02d",
(time.tm_year + 2000),
(time.tm_year + 1900),
(time.tm_mon + 1),
time.tm_mday,
time.tm_hour,