A simple clock in C
So, my goal was to make a simple clock in C++, but I had also been advised to use C, so I have made two clocks that do the exact same thing. This is the C version, and the next post is the C++ version.
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
int main(int argc, char** argv) {
A:
time_t now = time(0);
tm *ltm = localtime(&now);
printf("Day: %d\nMonth: %d\nYear: %d\n", ltm->tm_mday, 1 + ltm->tm_mon, 1900 + ltm->tm_year);
printf("Time: %02d:%02d:%02d\n", ltm->tm_hour, ltm->tm_min, ltm->tm_sec);
printf("The time is correct as long as your system is correct\n");
sleep(1);
system("clear");
goto A;
}