You might want to examine this line of code. Please test what happens when edge case h = 12. Your results might not be what you expect.
h_12 = h>=12 ? h-12 : h;
Test Case h = 12
void setup() {
// put your setup code here, to run once:
int h_12 = 12;
int h = 12;
h_12 = h>=12 ? h-12 : h;
Serial.begin(115200);
Serial.println(h_12);
}
void loop() {
// put your main code here, to run repeatedly:
}