[ale] In about 2.5 hours...

Jim Kinney jim.kinney at gmail.com
Fri Feb 13 14:45:51 EST 2009


tprt2.c:

#include <stdio.h>
#include <time.h>

int event = 1234567890;
int current;
int interval = 10;
int main (int  argc, char *argv[])
{
  time_t now;
  current = time(&now);
  if (event - current > interval)
    printf("Time now: %ld Time until event: %ld seconds
\r",current,event - current);
  if ((event - current <= interval ) && (event - current >= 0))
    printf("Time now: %ld Time until event: %ld seconds
\n",current,event - current);
  if (event - current < 0 )
    printf("Nothing to see here!\r");
}

gcc tprt2.c

while true
do
./a.out
sleep 1s
done


Change event and interval values to test.

2009/2/13 Charles Shapiro <hooterpincher at gmail.com>:
> Counting Down to the Significant Second:
>
> tprt.c:
>
> #include <stdio.h>
> #include <time.h>
>
> int main (int  argc, char *argv[])
> {
>   time_t now;
>   printf("Time: %ld\n",time(&now));
> }
>
>
> gcc tprt.c
>
> while true
> do
>    ./a.out >> tprt.out
>    sleep 1
> done
>
> tail -f ./tprt.out
>
> Current values for me on a work machine:
>
> Time: 1234549942
> Time: 1234549943
> Time: 1234549944
> Time: 1234549946
> Time: 1234549947
> Time: 1234549948
> Time: 1234549949
> Time: 1234549950
>
> -- CHS
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
>
>



-- 
-- 
James P. Kinney III


More information about the Ale mailing list