[ale] In about 2.5 hours...

Jim Kinney jim.kinney at gmail.com
Fri Feb 13 14:49:39 EST 2009


Dang! line wrap hell. The long printf are a single line each. there
are extra spaces before the trailing " to blank out if a line shrinks
from font spacing 0 vs 1, etc.

Forget a test out put:

Time now: 1234554195 Time until event: 5 seconds
Time now: 1234554196 Time until event: 4 seconds
Time now: 1234554197 Time until event: 3 seconds
Time now: 1234554198 Time until event: 2 seconds
Time now: 1234554199 Time until event: 1 seconds
Time now: 1234554200 Time until event: 0 seconds
Nothing to see here!

<ctrl>-C to exit

On Fri, Feb 13, 2009 at 2:45 PM, Jim Kinney <jim.kinney at gmail.com> wrote:
> 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
>



-- 
-- 
James P. Kinney III


More information about the Ale mailing list