diff --git a/pomo b/pomo new file mode 100755 index 0000000..fb8bc28 Binary files /dev/null and b/pomo differ diff --git a/pomo.c b/pomo.c index b5cc60d..8be8d1d 100644 --- a/pomo.c +++ b/pomo.c @@ -1,6 +1,7 @@ #include #include #include +#include #define MAX_MSG_LEN 100 #define LEN(a) (sizeof(a) / sizeof(a[0])) @@ -34,6 +35,19 @@ void spawn(char *argv[]){ } } +void print_time_now(){ + time_t timer; + char buffer[26]; + struct tm* tm_info; + + timer = time(NULL); + tm_info = localtime(&timer); + + strftime(buffer, 26, "%Y-%m-%d %H:%M:%S", tm_info); + fprintf(stderr, "%s", buffer); + +} + void display_message(char *msg){ char sh_command[MAX_MSG_LEN]; snprintf(sh_command, MAX_MSG_LEN, "echo '%s' | sent", msg); // NOLINT: We are being carefull here by considering MAX_MSG_LEN explicitly. @@ -45,7 +59,8 @@ void display_message(char *msg){ NULL }; spawn(spawn_args); - // fprintf(stderr, "%s\n", msg); + print_time_now(); + fprintf(stderr, " | %s\n", msg); } int main(int argc, char *argv[]){