diff --git a/main.c b/main.c index 27a06e2..0ab2cc1 100644 --- a/main.c +++ b/main.c @@ -3,11 +3,6 @@ #include #include -time_t buf; -struct tm bt; -struct tm et; -int flg = 1; - struct time { int hour; int min; @@ -17,11 +12,24 @@ struct date { int month; int day; }; +struct session { + struct date date; + struct time time; + int minutes; + char *name; +}; + +time_t buf; +struct time buf2; +struct tm bt; +struct tm et; +int flg = 1; + void sighnd() { flg = 0; } void flgwt() { while(flg) { continue; } } -int writeData(int fd, struct time time, int minutes); +int writeData(int fd, struct session session); struct time timediff(struct tm f, struct tm l) { struct time tmp; @@ -31,13 +39,17 @@ struct time timediff(struct tm f, struct tm l) { } int main(int argc, char **argv) { - if(argc == 1) { - buf = time(NULL); - bt = *localtime(&buf); - } + buf = time(NULL); + bt = *localtime(&buf); printf("%d:%02d:%02d\n", bt.tm_hour, bt.tm_min, bt.tm_year + 1900); + signal(SIGINT, sighnd); flgwt(); - printf("exiting lol\n"; + buf = time(NULL); + et = *localtime(&buf); + printf("%d:%02d:%02d:%02d\n", et.tm_hour, et.tm_min, et.tm_sec, et.tm_year + 1900); + buf2 = timediff(et, bt); + printf("%i:%i difference\n", buf2.hour, buf2.min); + printf("exiting lol\n"); return 0; }