Skip to content

Commit

Permalink
Fixed incorrect 12 hour date display
Browse files Browse the repository at this point in the history
The case checking for displaying the 12 hour format was incorrect. It would display 12:00 PM (aka, noon) as 00:00 PM.

close reefangel#232
  • Loading branch information
curtbinder committed Aug 6, 2017
1 parent f8d8553 commit fb6f73f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions RA_TouchLCD/RA_TouchLCD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,11 @@ void RA_TouchLCD::DrawDateTime(unsigned long t, int x, int y, boolean militaryti
}
else
{
if(hour()>=12)
sprintf(text,"%02d:%02d:%02d PM",hour(t)-12,minute(t),second(t));
else
sprintf(text,"%02d:%02d:%02d AM",hour(t),minute(t),second(t));
int h = hour(t);
if(h > 12) {
h = h - 12;
}
sprintf(text, "%02d:%02d:%02d %s", h, minute(t), second(t), (hour(t)>=12)?"PM":"AM");
}
Font.DrawText(text);
}
Expand Down

0 comments on commit fb6f73f

Please sign in to comment.