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 ) {
sprintf(hoursChar, "%02d", hour);
} else {
if (hour > 12) {
hour -= 12;
sprintf(ampmChar, "PM");
} else {
sprintf(ampmChar, "AM");
if (hour == 0 && hour != 12) {
hour = 12;
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);
}