blob: cc078f41f688a62f923f4408b91b99427ef77d34 (
plain)
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4 #include <time.h>
5
6 #include "ctime.h"
7
8 int main(int argc, char* argv[]) {
9 int i = 1;
10
11 // Don't override anything previous
12 printf("\n");
13
14 int sleep_sec = 1;
15 int sleep_usec = sleep_sec * 1000000;
16
17 ctime_t t;
18 ctime_t_new(&t);
19
20 while(0 == 0) {
21 printf("\r%02d:%02d", t.min, t.sec);
22 ctime_add_sec(&t, 1);
23 fflush(stdout);
24 i++;
25 usleep(sleep_usec);
26 }
27 printf("\n");
28 }
|