From 6f331d6fcb273bd99a0e3fc0090c36e88d19e9ac Mon Sep 17 00:00:00 2001 From: Sean Qureshi Date: Fri, 2 Aug 2013 17:14:47 -0700 Subject: [PATCH] Fixed a bug with the minutes only being 1 character long when less than 10 --- chat.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/chat.c b/chat.c index 10837aa..50aa81b 100644 --- a/chat.c +++ b/chat.c @@ -52,7 +52,12 @@ static void chat_onMessage(ToxWindow* self, int num, uint8_t* msg, uint16_t len) char min[2]; char hour[2]; sprintf(hour,"%d",inthour); - sprintf(min,"%d",intmin); + if (intmin < 10) { + sprintf(min,"0%d",intmin); + } else { + sprintf(min,"%d",intmin); + } + wattron(ctx->history, COLOR_PAIR(2)); wprintw(ctx->history,"%s",hour); @@ -109,7 +114,11 @@ static void chat_onKey(ToxWindow* self, int key) { char min[2]; char hour[2]; sprintf(hour,"%d",inthour); - sprintf(min,"%d",intmin); + if (intmin < 10) { + sprintf(min,"0%d",intmin); + } else { + sprintf(min,"%d",intmin); + } wattron(ctx->history, COLOR_PAIR(2)); wprintw(ctx->history,"%s",hour);