Fix zero hour handling for 12-hour mode
This commit is contained in:
@@ -243,6 +243,9 @@ uint64_t render_time(bool colons = true) {
|
|||||||
time_t now = time(nullptr);
|
time_t now = time(nullptr);
|
||||||
localtime_r(&now, &timeinfo);
|
localtime_r(&now, &timeinfo);
|
||||||
int h = timeinfo.tm_hour % configHourFormat;
|
int h = timeinfo.tm_hour % configHourFormat;
|
||||||
|
if (configHourFormat == 12 && h == 0) {
|
||||||
|
h = 12; // TODO: Parameter to configure 12-hour format
|
||||||
|
}
|
||||||
int m = timeinfo.tm_min;
|
int m = timeinfo.tm_min;
|
||||||
int s = timeinfo.tm_sec;
|
int s = timeinfo.tm_sec;
|
||||||
return render_digits(h / 10, h % 10, m / 10, m % 10, s / 10, s % 10) | (colons ? COLON_ALL : 0);
|
return render_digits(h / 10, h % 10, m / 10, m % 10, s / 10, s % 10) | (colons ? COLON_ALL : 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user