Robert Hodson

MQX 3.8  _time_get() ->_time_to_date defect

Discussion created by Robert Hodson on Sep 20, 2012
Latest reply on Apr 4, 2013 by Martin Bielik

I noticed the following behavior in my code using the MQX 3.8 and the  K60 BSP -didn't confirm other processors

 

occasionally the following pair of calls will fail, and the _time_to_date function will return FALSE. Though you wouldn't notice it since most MQX internal calls ignore the _time_to_date function return value. This seems to be the source of a ton of file time stamp glitches I have noticed.

 

I was using the following code and had to change it, but the problem still exist all over MQX. I will probably patch MQX myself.

_time_get(&time_mqx);

_time_to_date(&time_mqx, &clk_time);

 

My fix for the snippet was :

_time_get(&time_mqx);

/* Fix for a wonderful little MQX bug*/

    if (time_mqx.MILLISECONDS ==1000){

   time_mqx.MILLISECONDS =0;
   time_mqx.SECONDS++;

    }

_time_to_date(&time_mqx, &clk_time);


 

 

   

Outcomes