added bigclock_format to config.ini

This commit is contained in:
catdotjs 2023-12-18 15:27:34 +02:00
parent ff0be009ad
commit 463644549b
2 changed files with 5 additions and 2 deletions

View File

@ -12,6 +12,9 @@
# enable/disable big clock # enable/disable big clock
#bigclock = true #bigclock = true
# Big clock formatting (see strftime specification) [allowed symbols 1-9,-,:]
#bigclock_format = %c
# The character used to mask the password # The character used to mask the password
#asterisk = * #asterisk = *

View File

@ -240,11 +240,11 @@ void alpha_blit(struct tb_cell* buf, uint16_t x, uint16_t y, uint16_t w, uint16_
void draw_bigclock(struct term_buf* buf) void draw_bigclock(struct term_buf* buf)
{ {
if (!config.bigclock) uint32_t bigclocklength = strlen(config.bigclock_format);
if (!config.bigclock || bigclocklength == 0)
{ {
return; return;
} }
uint32_t bigclocklength = strlen(config.bigclock_format);
int xo = (buf->width / 2) - bigclocklength * (CLOCK_W+1) / 2; int xo = (buf->width / 2) - bigclocklength * (CLOCK_W+1) / 2;
int yo = (buf->height - buf->box_height) / 2 - CLOCK_H - 2; int yo = (buf->height - buf->box_height) / 2 - CLOCK_H - 2;