aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordam <dam@gudinoff>2022-09-25 23:00:07 +0000
committerdam <dam@gudinoff>2022-09-25 23:00:07 +0000
commit93513c90ab62c124b8800722cce7af041fcc0707 (patch)
treede20c0c61607c4fbc1c6f68b64c2a32984c82121
parent0e33be9c67c5e44bbdfcaecb13478f6a58e3867d (diff)
downloadtask-time-tracker-93513c90ab62c124b8800722cce7af041fcc0707.tar.zst
task-time-tracker-93513c90ab62c124b8800722cce7af041fcc0707.zip
Adjusted format_time when showing less than 60 seconds.
-rw-r--r--main.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/main.c b/main.c
index cce6154..b1c44af 100644
--- a/main.c
+++ b/main.c
@@ -1,6 +1,6 @@
// Compilation command:
-// - release: gcc main.c -Wall -pedantic -O2 -m64 -lncursesw -o ttt
-// - debug : gcc main.c -Wall -pedantic -g3 -m64 -lncursesw -o ttt -D DEBUG
+// - release: gcc main.c -Wall -Werror -pedantic -O2 -m64 -lncursesw -o ttt
+// - debug : gcc main.c -Wall -Werror -pedantic -g3 -m64 -lncursesw -o ttt -D DEBUG
#include <assert.h>
@@ -124,10 +124,10 @@ char *format_time(intmax_t time, char* string, int length) {
sprintf(string, "%*s%02jd:%02jd%*s", left_padding, "", hours, minutes, right_padding, "");
}
else if (time > 0) {
- sprintf(string, "%*s%4jds%*s", left_padding, "", time, right_padding, "");
+ sprintf(string, "%*s%3jds %*s", left_padding, "", time, right_padding, "");
}
else if (time == 0) {
- sprintf(string, "%*s", length, "");
+ sprintf(string, "%*s 0 %*s", left_padding, "", right_padding, "");
}
else {
sprintf(string, "%*s - %*s", left_padding, "", right_padding, "");
@@ -1031,7 +1031,6 @@ int main(int argc, char *argv[]) {
curs_set(1);
// TODO Make cursor blink.
mvgetnstr(row, 1, new_task->name, MAX_TASK_NAME-1);
-
// TODO Move this empty-name-cleaning code elsewhere.
bool is_empty = true;
int size = strlen(new_task->name);