fix AM/PM

This commit is contained in:
Joaquim José Almeida Pereira 2021-03-08 12:23:32 +00:00
parent 524e204ed1
commit 282e34dca1

View File

@ -160,11 +160,21 @@ bool WatchFaceDigital::Refresh() {
if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H24 ) { if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H24 ) {
sprintf(hoursChar, "%02d", hour); sprintf(hoursChar, "%02d", hour);
} else { } else {
if (hour > 12) { if (hour == 0 && hour != 12) {
hour -= 12; hour = 12;
sprintf(ampmChar, "PM"); sprintf(ampmChar, "AM");
} else { }
sprintf(ampmChar, "AM"); else if (hour == 12 && hour != 0) {
hour = 12;
sprintf(ampmChar, "PM");
}
else if (hour < 12 && hour != 0) {
sprintf(ampmChar, "AM");
}
else if (hour > 12 && hour != 0)
{
hour = hour - 12;
sprintf(ampmChar, "PM");
} }
sprintf(hoursChar, "%02d", hour); sprintf(hoursChar, "%02d", hour);
} }