Minor date/time conversion loop style fixes

This commit is contained in:
TuxSH 2017-12-19 02:32:51 +01:00
parent 4eaf791849
commit 2a840f2c79

View File

@ -191,21 +191,21 @@ void RosalinaMenu_TakeScreenshot(void)
year = 1900; // osGetTime starts in 1900 year = 1900; // osGetTime starts in 1900
while(1) while(true)
{ {
bool leapYear = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); bool leapYear = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
uint16_t daysInYear = leapYear ? 366 : 365; u16 daysInYear = leapYear ? 366 : 365;
if (days >= daysInYear) if(days >= daysInYear)
{ {
days -= daysInYear; days -= daysInYear;
++year; ++year;
} }
else else
{ {
static const uint8_t daysInMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; static const u8 daysInMonth[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
for(month = 0; month < 12; ++month) for(month = 0; month < 12; ++month)
{ {
uint8_t dim = daysInMonth[month]; u8 dim = daysInMonth[month];
if (month == 1 && leapYear) if (month == 1 && leapYear)
++dim; ++dim;