diff options
author | Sean Qureshi <stqism@risingstormgames.com> | 2013-08-02 17:14:47 -0700 |
---|---|---|
committer | Sean Qureshi <stqism@risingstormgames.com> | 2013-08-02 17:14:47 -0700 |
commit | 9267ab2fcaaaedb70c68de6daccea1660138312d (patch) | |
tree | aee879beb8e5e8189a032429ac41702547e8b0fa /testing | |
parent | 10feea4474e53c12b74e4334042b13a5d5cfe94f (diff) |
Fixed a bug with the minutes only being 1 character long when less than 10
Diffstat (limited to 'testing')
-rw-r--r-- | testing/toxic/chat.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/testing/toxic/chat.c b/testing/toxic/chat.c index 10837aa7..50aa81b0 100644 --- a/testing/toxic/chat.c +++ b/testing/toxic/chat.c | |||
@@ -52,7 +52,12 @@ static void chat_onMessage(ToxWindow* self, int num, uint8_t* msg, uint16_t len) | |||
52 | char min[2]; | 52 | char min[2]; |
53 | char hour[2]; | 53 | char hour[2]; |
54 | sprintf(hour,"%d",inthour); | 54 | sprintf(hour,"%d",inthour); |
55 | sprintf(min,"%d",intmin); | 55 | if (intmin < 10) { |
56 | sprintf(min,"0%d",intmin); | ||
57 | } else { | ||
58 | sprintf(min,"%d",intmin); | ||
59 | } | ||
60 | |||
56 | 61 | ||
57 | wattron(ctx->history, COLOR_PAIR(2)); | 62 | wattron(ctx->history, COLOR_PAIR(2)); |
58 | wprintw(ctx->history,"%s",hour); | 63 | wprintw(ctx->history,"%s",hour); |
@@ -109,7 +114,11 @@ static void chat_onKey(ToxWindow* self, int key) { | |||
109 | char min[2]; | 114 | char min[2]; |
110 | char hour[2]; | 115 | char hour[2]; |
111 | sprintf(hour,"%d",inthour); | 116 | sprintf(hour,"%d",inthour); |
112 | sprintf(min,"%d",intmin); | 117 | if (intmin < 10) { |
118 | sprintf(min,"0%d",intmin); | ||
119 | } else { | ||
120 | sprintf(min,"%d",intmin); | ||
121 | } | ||
113 | 122 | ||
114 | wattron(ctx->history, COLOR_PAIR(2)); | 123 | wattron(ctx->history, COLOR_PAIR(2)); |
115 | wprintw(ctx->history,"%s",hour); | 124 | wprintw(ctx->history,"%s",hour); |