Added the useless clock.

This commit is contained in:
Barra Ó Catháin 2024-04-18 14:38:38 +01:00
parent ed93535d1b
commit 2a22708350
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
int main (int argc, char ** argv)
{
time_t timestamp;
struct tm * timeinfo;
srand(time(NULL));
while (true)
{
time(&timestamp);
timeinfo = localtime(&timestamp);
if ((rand() % 10) == 0)
{
printf("The time is now for coffee. Coffee time it is.\n");
}
else
{
printf("The time is now: %s", asctime(timeinfo));
}
fflush(stdout);
sleep(rand() % 12);
}
return 0;
}