Skip to content

FR: 12 Hour Clock? #5

@JimmXinu

Description

@JimmXinu

Could the clock on the USBMS screen display 12 hour time when ["twelve_hour_clock"] = true is set in koreader settings?

USBMS has an example of how to read settings:

KoboUSBMS/usbms.c

Lines 479 to 495 in 726f5ef

snprintf(ko_settings, sizeof(ko_settings) - 1U, "%s/settings.reader.lua", ko_dir);
f = fopen(ko_settings, "re");
if (f) {
bool found_state = false;
bool fl_state = false;
bool found_intensity = false;
uint8_t fl_intensity = 0U;
char* line = NULL;
line = calloc(PIPE_BUF, sizeof(*line));
if (!line) {
PFLOG(LOG_ERR, "calloc: %m");
fclose(f);
return intensity;
}
while (fgets(line, PIPE_BUF, f)) {
char* cur_line = line;
if (strstr(cur_line, "[\"is_frontlight_on\"]")) {

And the clock formatting code, currently:

strftime(sz_time, sizeof(sz_time), "%H:%M", lt);

...could conditionally display 12/24 hour clock something like:

	if (twelve_hour_clock) {
		strftime(sz_time, sizeof(sz_time), "%I:%M %p", lt);
	} else {
		strftime(sz_time, sizeof(sz_time), "%H:%M", lt);
	}

I'd offer a PR, but I don't have a build environ to test in, and how to implement reading the setting could go a couple different ways.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions