Not sure what the issue here is with the time function or some log issue?

Home Forums mDot/xDot Not sure what the issue here is with the time function or some log issue?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #31238
    Ajay K
    Participant

    I am seeing a bizarre issue when compiling our firmware with mDot library 4.0.0 and mbed os 6.1.0. when this piece of code below runs on the mDot I get different results for the time being stored in these local and instance variables. The m_tSuccessfulPktTranmitTimeInSeconds is a class instance variable of type time_t. I can’t reproduce this issue in the prior versions of the mdot library or mbed os i.e. pre 6.0.0.

    time(&m_tSuccessfulPktTranmitTimeInSeconds);
    time_t currentTime = time(NULL);
    					
    logDebug("Transmission Time: %u seconds, Current Time: %u Seconds!!", m_tSuccessfulPktTranmitTimeInSeconds, currentTime);

    Here is what is printed out:

    Transmission Time: 536872128 seconds, Current Time: 1451606717 Seconds

    The variable m_tSuccessfulPktTranmitTimeInSeconds stays stuck at this value 536872128 or it seems so in the logs. Any thoughts or is this some kind of bizarre logging issue?

    Thanks,
    Ajay

    #31239
    Jason Reiss
    Keymaster

    Do you get the same results if you use one logDebug per variable?
    I have seen issues in the past when too many variables are provided to the print format statements. It seemed to be more prevalent when printing large numbers.

    #31240
    Jason Reiss
    Keymaster

    printf(“time: %” PRId64 “\r\n”, time(NULL));

    #31241
    Ajay K
    Participant

    I did try printing them separately and the same result as described earlier. However is the length of the variable name a factor here? I have practically written a sentence for my variable name :).

    Thanks,
    Ajay

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.