[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] In about 2.5 hours...



You might miss the second of interest, since the
actual delay between invocations of tprt will be
longer than one second in many cases, due to
bash overhead, process spawning overhead, etc. I'd
suggest putting a "usleep(500000);" in tprt.c and
omitting the "sleep 1" from the shellscript. Yeah,
you get a lot of duplicate seconds, but better safe
than sorry. Especially in such a critical piece of
code!

-- JK

Charles Shapiro wrote:
> 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


-- 
I do not particularly want to go where the money is -
  it usually does not smell nice there. -- A. Stepanov