diff options
Diffstat (limited to 'src')
-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); |