This repository has been archived on 2023-06-23. You can view files and clone it, but cannot push or open issues or pull requests.
practice/main.c

44 lines
790 B
C

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <signal.h>
time_t buf;
struct tm bt;
struct tm et;
int flg = 1;
struct time {
int hour;
int min;
};
struct date {
int year;
int month;
int day;
};
void sighnd() { flg = 0; }
void flgwt() { while(flg) { continue; } }
int writeData(int fd, struct time time, int minutes);
struct time timediff(struct tm f, struct tm l) {
struct time tmp;
tmp.hour = f.tm_hour - l.tm_hour;
tmp.min = f.tm_min - l.tm_min;
return tmp;
}
int main(int argc, char **argv) {
if(argc == 1) {
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";
return 0;
}