This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

低功耗蓝牙中UTCTimeStruct转换为UTCtime时间对月份和年循环条件的问题?



 /* Next, complete months in current year */
    {
      int8 month = tm->month;
      while ( --month >= 0 )//这里有没错呢?你先把一个月减了
      //是不是少计数了一个月
      {
        days += monthLength( IsLeapYear( tm->year ), month );
      }
    }

    /* Next, complete years before current year */
    {
      uint16 year = tm->year;
      while ( --year >= BEGYEAR )
      {
        days += YearLength( year );
      }
    }

问题是在这里将时间数据由 UTCTimeStruct转换为UTCtime时间对月份和年循环条件。比如--year>=BEGYEAR是不是上算了一年。