This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Warnings I cannot understand after compilation-Part1

This is going to be a strange request. I must warn that I am new to embedded programming and therefore what is obvious to you may not be to me.
I am trying to implement a real time clock program with the data then being transmitted on CAN. I am getting some warning when I compile my code and cannot understand what I need to do. Any help would be appreciated. I will be posting my code in parts as I cannot exceed a certain character limit.

Parents
  • By the way - incrementing the day is only correct if currentRT() is called at least once / 24 hours. If called more seldom, then you may have stepped more than one day.

    You might do:

    while (time.daysa > time.daysb) {
        time.daysb++;
        current_day++;
    }
    

    or

    if (time.daysa > time.daysb) {
        current_day += (time.daysa - time.daysb);
        time.daysb = time.daysa;
    }
    

Reply
  • By the way - incrementing the day is only correct if currentRT() is called at least once / 24 hours. If called more seldom, then you may have stepped more than one day.

    You might do:

    while (time.daysa > time.daysb) {
        time.daysb++;
        current_day++;
    }
    

    or

    if (time.daysa > time.daysb) {
        current_day += (time.daysa - time.daysb);
        time.daysb = time.daysa;
    }
    

Children
No data