1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-26 16:43:27 +01:00

Fixed a bug with the minutes only being 1 character long when less than 10

This commit is contained in:
Sean Qureshi 2013-08-02 17:14:47 -07:00
parent 873736df5c
commit 6f331d6fcb

9
chat.c
View File

@ -52,7 +52,12 @@ static void chat_onMessage(ToxWindow* self, int num, uint8_t* msg, uint16_t len)
char min[2]; char min[2];
char hour[2]; char hour[2];
sprintf(hour,"%d",inthour); sprintf(hour,"%d",inthour);
if (intmin < 10) {
sprintf(min,"0%d",intmin);
} else {
sprintf(min,"%d",intmin); sprintf(min,"%d",intmin);
}
wattron(ctx->history, COLOR_PAIR(2)); wattron(ctx->history, COLOR_PAIR(2));
wprintw(ctx->history,"%s",hour); wprintw(ctx->history,"%s",hour);
@ -109,7 +114,11 @@ static void chat_onKey(ToxWindow* self, int key) {
char min[2]; char min[2];
char hour[2]; char hour[2];
sprintf(hour,"%d",inthour); sprintf(hour,"%d",inthour);
if (intmin < 10) {
sprintf(min,"0%d",intmin);
} else {
sprintf(min,"%d",intmin); sprintf(min,"%d",intmin);
}
wattron(ctx->history, COLOR_PAIR(2)); wattron(ctx->history, COLOR_PAIR(2));
wprintw(ctx->history,"%s",hour); wprintw(ctx->history,"%s",hour);