Update window when date string change - tty-clock - port of tty-clock to OpenBSD, with pledge/unveil added as goodie.
 (HTM) git clone https://git.drkhsh.at/tty-clock.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 84fd64b77c8061b54174e43e3ac9508e01e23458
 (DIR) parent 9e00c32098524c30dac4dab701f7e33f8bc7c880
 (HTM) Author: aboven <arieboven@protonmail.com>
       Date:   Tue, 20 Apr 2021 19:53:46 +0200
       
       Update window when date string change
       
       Diffstat:
         M ttyclock.c                          |      10 ++++++++++
         M ttyclock.h                          |       1 +
       
       2 files changed, 11 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/ttyclock.c b/ttyclock.c
       @@ -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);
 (DIR) diff --git a/ttyclock.h b/ttyclock.h
       @@ -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 */