diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-10-18 20:13:17 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-10-18 20:13:17 (EDT) |
commit | c84a2ea0756c4a749cff5aff7aa029e880d1a5c6 (patch) | |
tree | 2423ecf9fded4dc2b5aaaebba5e9005b730b45c9 | |
parent | 17d73cdba7204d48918ecfdda78d4e79948e1358 (diff) | |
download | timeteller-c84a2ea0756c4a749cff5aff7aa029e880d1a5c6.zip timeteller-c84a2ea0756c4a749cff5aff7aa029e880d1a5c6.tar.gz timeteller-c84a2ea0756c4a749cff5aff7aa029e880d1a5c6.tar.bz2 |
clock_clear(): New function
-rw-r--r-- | src/clock.c | 18 | ||||
-rw-r--r-- | src/clock.h | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/clock.c b/src/clock.c index f6ffdcf..a914aa3 100644 --- a/src/clock.c +++ b/src/clock.c @@ -51,8 +51,10 @@ static const uint16_t _clock_font[] = { 075757, /* 8 */ 075717, /* 9 */ 004040, /* : */ + 000000, /* Blank */ }; #define COLON_DIGIT 10 +#define BLANK_DIGIT 11 struct clock { WINDOW *win; @@ -184,6 +186,22 @@ clock_draw(struct clock *clock) _clock_draw_digit(clock, x += SPACING + DIGIT_WIDTH, tm->tm_sec % 10); } +void +clock_clear(struct clock *clock) +{ + int x; + + x = 0; + _clock_draw_digit(clock, x += SPACING , BLANK_DIGIT); + _clock_draw_digit(clock, x += SPACING + DIGIT_WIDTH, BLANK_DIGIT); + _clock_draw_digit(clock, x += SPACING + DIGIT_WIDTH, BLANK_DIGIT); + _clock_draw_digit(clock, x += SPACING + COLON_WIDTH, BLANK_DIGIT); + _clock_draw_digit(clock, x += SPACING + DIGIT_WIDTH, BLANK_DIGIT); + _clock_draw_digit(clock, x += SPACING + DIGIT_WIDTH, BLANK_DIGIT); + _clock_draw_digit(clock, x += SPACING + COLON_WIDTH, BLANK_DIGIT); + _clock_draw_digit(clock, x += SPACING + DIGIT_WIDTH, BLANK_DIGIT); +} + struct clock * clock_destroy(struct clock **clock_p) { diff --git a/src/clock.h b/src/clock.h index 9851ddd..8bd0a24 100644 --- a/src/clock.h +++ b/src/clock.h @@ -38,6 +38,9 @@ clock_size(struct clock *clock); void clock_draw(struct clock *clock); +void +clock_clear(struct clock *clock); + struct clock * clock_destroy(struct clock **clock_p); |