Compare commits
2 Commits
62deeebe63
...
2a22708350
Author | SHA1 | Date |
---|---|---|
Barra Ó Catháin | 2a22708350 | |
Barra Ó Catháin | ed93535d1b |
|
@ -1,3 +1,3 @@
|
||||||
# the-worlds-least-useful-clock
|
* the-worlds-least-useful-clock
|
||||||
|
|
||||||
An example application for use in demonstrating Docker images and the Openshift Image Registry
|
An example application for use in demonstrating Docker images and the Openshift Image Registry
|
|
@ -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(×tamp);
|
||||||
|
timeinfo = localtime(×tamp);
|
||||||
|
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;
|
||||||
|
}
|
Loading…
Reference in New Issue