From 3bf6fea43dd1cf0bb4470298b848e0fe51a7b125 Mon Sep 17 00:00:00 2001 From: bjt-user Date: Sat, 23 Nov 2024 15:30:11 +0100 Subject: [PATCH] removed uncommented code, updated readme --- README.md | 3 +-- src/date_time_handling.c | 26 +------------------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index a7f474c..5b6bdbc 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,5 @@ This will run ctags on every commit. #### TODO -- real and automated unit testing -- fix stack smashing bug (test file: failed_cal.ics) +- improve and automate unit testing - add cli argument that will not show ongoing events, only upcoming events diff --git a/src/date_time_handling.c b/src/date_time_handling.c index 248a649..d390410 100644 --- a/src/date_time_handling.c +++ b/src/date_time_handling.c @@ -27,6 +27,7 @@ void get_date (char buffer[]) { // 20241209 -> 2024-12-09 // caller has to free() the returned char array char* pretty_date_time (char date_time[]) { + // need one more char in the char pointer for null-termination int pdt_len = 20; if (!strchr (date_time, 'T')) { pdt_len = 11; @@ -64,37 +65,12 @@ char* pretty_date_time (char date_time[]) { return pretty_dt; } -// 20230823T194138 -> 2023-08-23 19:41:38 void pretty_print_date_time (char date_time[]) { char* pdt = pretty_date_time(date_time); printf("%s", pdt); free(pdt); - /* - // copy date_time because strtok will destroy it - char date_time_copy[15] = ""; - strcpy (date_time_copy, date_time); - - char* date = strtok (date_time, "T"); - char* time = strtok (NULL, "T"); - if (date == NULL) { - printf ("\nError: date points to NULL!\n"); - exit (1); - } - printf ("%c%c%c%c-", date[0], date[1], date[2], date[3]); - printf ("%c%c-", date[4], date[5]); - printf ("%c%c", date[6], date[7]); - - if (time != NULL) { - printf (" %c%c:", time[0], time[1]); - printf ("%c%c:", time[2], time[3]); - printf ("%c%c", time[4], time[5]); - } - - // put variable date_time back together - strcpy (date_time, date_time_copy); - */ } void marshall_date_time (char date_time[]) {