summaryrefslogtreecommitdiff
path: root/src/main.c
blob: e64afe419fc41adf9c43a1a35da0850f27b14419 (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%03d days %02dh %02dm %02ds", t.day, t.hour, t.min, t.sec);
   22     ctime_add_sec(&t, 1);
   23     fflush(stdout);
   24     i++;
   25     usleep(sleep_usec);
   26   }
   27   printf("\n");
   28 }

Generated by cgit