Merge pull request #94 from arieboven/master

Update window when date string change
master
anarcat 4 years ago committed by GitHub
commit f2f847cf2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      ttyclock.c
  2. 1
      ttyclock.h

@ -200,6 +200,7 @@ update_hour(void)
ttyclock.date.minute[1] = ttyclock.tm->tm_min % 10;
/* Set date string */
strcpy(ttyclock.date.old_datestr, ttyclock.date.datestr);
strftime(tmpstr,
sizeof(tmpstr),
ttyclock.option.format,
@ -242,6 +243,15 @@ draw_number(int n, int x, int y)
void
draw_clock(void)
{
if (ttyclock.option.date && !ttyclock.option.rebound &&
strcmp(ttyclock.date.datestr, ttyclock.date.old_datestr) != 0)
{
clock_move(ttyclock.geo.x,
ttyclock.geo.y,
ttyclock.geo.w,
ttyclock.geo.h);
}
/* Draw hour numbers */
draw_number(ttyclock.date.hour[0], 1, 1);
draw_number(ttyclock.date.hour[1], 1, 8);

@ -102,6 +102,7 @@ typedef struct
unsigned int minute[2];
unsigned int second[2];
char datestr[256];
char old_datestr[256];
} date;
/* time.h utils */

Loading…
Cancel
Save