It turns our that time_from_date() and time_to_date(), both use a look-up table, _time_secs_before_year_internal[], to convert years to seconds since 1970. If you open "\Freescale MQX 3.8\mqx\source\kernel\ti_rom.c" you will find that 1995 has been entered as 1996. There are two entries for 1996 and no entry for 1995.
((1994UL-1970UL) * SECS_IN_YEAR) + ( 6UL * SECS_IN_DAY),
((1996UL-1970UL) * SECS_IN_YEAR) + ( 6UL * SECS_IN_DAY),
((1996UL-1970UL) * SECS_IN_YEAR) + ( 6UL * SECS_IN_DAY),
So to fix this problem, replace 1996UL with 1995UL and recompile libraries.
Cheers,
Wayne
Solved! Go to Solution.
Thank you for your bug report.
You are right it is obvious bug.
I check that this bug was in MQX up to MQX 4.0.2.2 version (time_tables.c file).
Since MQX 4.1.0, _time_secs_before_year_internal[] table is not part of MQX code.
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you for your bug report.
You are right it is obvious bug.
I check that this bug was in MQX up to MQX 4.0.2.2 version (time_tables.c file).
Since MQX 4.1.0, _time_secs_before_year_internal[] table is not part of MQX code.
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------