summaryrefslogtreecommitdiffstats
path: root/src/clock.c
diff options
context:
space:
mode:
authorPatrick 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)
commitc84a2ea0756c4a749cff5aff7aa029e880d1a5c6 (patch)
tree2423ecf9fded4dc2b5aaaebba5e9005b730b45c9 /src/clock.c
parent17d73cdba7204d48918ecfdda78d4e79948e1358 (diff)
downloadtimeteller-c84a2ea0756c4a749cff5aff7aa029e880d1a5c6.zip
timeteller-c84a2ea0756c4a749cff5aff7aa029e880d1a5c6.tar.gz
timeteller-c84a2ea0756c4a749cff5aff7aa029e880d1a5c6.tar.bz2
clock_clear(): New function
Diffstat (limited to 'src/clock.c')
-rw-r--r--src/clock.c18
1 files changed, 18 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)
{