Re-Add meridiem sign to date string and fix help page

reverse-branch
Martin Duquesnoy 17 years ago
parent a32ee816f7
commit 68afd752e3
  1. 14
      ttyclock.c
  2. 2
      ttyclock.h

@ -132,6 +132,7 @@ void
update_hour(void)
{
int ihour;
char tmpstr[128];
ttyclock->tm = localtime(&(ttyclock->lt));
ttyclock->lt = time(NULL);
@ -141,7 +142,7 @@ update_hour(void)
if(ttyclock->option.twelve)
ttyclock->meridiem = ((ihour > 12) ? PMSIGN : AMSIGN);
else
ttyclock->meridiem = "";
ttyclock->meridiem = "\0";
/* Manage hour for twelve mode */
ihour = ((ttyclock->option.twelve && ihour > 12) ? (ihour - 12) : ihour);
@ -156,10 +157,11 @@ update_hour(void)
ttyclock->date.minute[1] = ttyclock->tm->tm_min % 10;
/* Set date string */
strftime(ttyclock->date.datestr,
sizeof(ttyclock->date.datestr),
strftime(tmpstr,
sizeof(tmpstr),
ttyclock->option.format,
ttyclock->tm);
sprintf(ttyclock->date.datestr, "%s%s", tmpstr, ttyclock->meridiem);
/* Set seconds */
ttyclock->date.second[0] = ttyclock->tm->tm_sec / 10;
@ -418,13 +420,13 @@ main(int argc, char **argv)
{
case 'h':
default:
printf("tty-clock usage : tty-clock [-option] \n"
printf("usage : tty-clock [-sctrvih] [-C [0-7]] [-f format] \n"
" -s Show seconds \n"
" -c Set the clock at the center of the terminal \n"
" -C <num> Set the clock color \n"
" -C [0-7] Set the clock color \n"
" -t Set the hour in 12h format \n"
" -r Do rebound the clock \n"
" -f <format> Set the date format \n"
" -f format Set the date format \n"
" -v Show tty-clock version \n"
" -i Show some info about tty-clock \n"
" -h Show this page \n");

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

Loading…
Cancel
Save